Forum Discussion

scott.piekarczyk's avatar
scott.piekarczyk
Copper Contributor
Oct 19, 2018

SIMPLE Excel IF statement I have used for years not working

why does the formula =if($d10="X",1000,2000)

give the same answer if d10 = X or is blank? When a numeric or alpha other than X is in D10, the answer is 2000

3 Replies

  • Scott, can you attach your file or a sample one with same issue?

    In my tests, if D10 is X or x, I get 1000 and if D10 is blank or anything else but X, I get 2000.

  • Lorenzo Kim's avatar
    Lorenzo Kim
    Bronze Contributor
    the meaning of the formula =if($d10="X",1000,2000) is:
    if cell D10 is "X" then the value at that formula cell would be 1000
    if D10 is not "X" - then the cell would show 2000

    but if you want the cell to show nothing or blank, then change the formula to:
    =if($D10="X",1000,"")
    meaning, if D10 is not "X" - the cell would show nothing or blank.

    HTH


    • scott.piekarczyk's avatar
      scott.piekarczyk
      Copper Contributor

      Hi All,

       

      I copied the worksheet to a new worksheet in the same workbook and it works correctly in the new worksheet.  I deleted the original worksheet, no idea why it was not working as per IF, THEN, ELSE logic.  Before I deleted the original worksheet, I overwrote the original worksheet with the cells from the new worksheet and still it did not work correctly.

Resources