+ Reply to Thread
Results 1 to 4 of 4

Combine If statement and Mid Statement

  1. #1
    Registered User
    Join Date
    10-14-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Combine If statement and Mid Statement

    Good Morning,
    Trying to Combine If statement and a Mid statement in One Cell vs two separate cell.
    Cell with text in it is D2--cell reads-- 001-012400-000-7010-000.
    from this I used =mid(d2,5,6) returns 012400 - which was easy but I want IF that was true do this..
    the if this true I want the formula to return the word "Location" if don't match then blank cell.
    I wrote this - but doesn't work.

    =If(MID(d2,5,6)="012400","Location"," ")

    Any help would be great
    thanks
    Chris
    Last edited by romperstomper; 05-19-2011 at 02:19 AM.

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Combine If statement and Mid Statement

    Your formula looks right and when I tested it the result was as expected - "Location".

    Are you sure you want " " as the result when not true. Usually the preferred result would be just "" (no space).

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Combine If statement and Mid Statement

    Same as Cutter. See attached.
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Registered User
    Join Date
    10-14-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Combine If statement and Mid Statement

    Thanks- It worked.

    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1