+ Reply to Thread
Results 1 to 4 of 4

If statement issue

  1. #1
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    294

    If statement issue

    Hi,

    I'm having a problem with an IF statement. I'm trying various things but I can't get it to work the way I want. The statement is below:

    =IF(M2="DC9011","DC",IF(M2="DC9021","DC","DSD"))

    What this is doing is returning DC if either DC9011 or DC9021. If M2 is not DC9011 or DC9021 then it is returning DSD. It works fine for what it is doing now but I would like to add something else to to it. I'm not always sure that there will be data in cell M2 and right now the formula is returning DSD if M2 is blank.

    What I would like it do it leave the cell blank if M2 is blank. I'm trying various IF, AND, and Or statements with <>"" but I can't get it to work.

    Any thoughts are more than welcome.

    Thanks

    Eddie.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    Try

    =IF(M2="","",IF(OR(M2="DC9011",M2="DC9021"),"DC","DSD"))

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    10-28-2003
    Location
    Happyville, USA
    MS-Off Ver
    365
    Posts
    294
    That worked awesome. Thanks

    Eddie.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Glad it worked for you


    VBA Noob

+ 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