Excel If cell is blank show nothing else carry out this IF statement

1

I have the following formula

=IF(N37="Y",5,-5)

At the moment it shows -5.00 if the cell N37 is blank however I have it to display nothing until the cell contains N or Y.

Phil Nind

Posted 2016-02-18T09:48:01.867

Reputation: 21

Answers

1

Assuming -5 is supposed to be when you have N:

=IF(N37="Y",5,IF(N37="N",-5,""))

If Y, then 5.

If Not Y, then, IF N, -5.

If Not Y and Not N, "" (blank string)

Answering your comment, you need to use a slightly different formula if using numbers:

=IF(AND(NOT(ISBLANK(P37)),NOT(ISBLANK(O37)),P37<=O37/2),"Y",IF(AND(NOT(ISBLANK(P37)),NOT(ISBLANK(O37)),P37>=O37/2),"N",""))

As blank cells will be treated as zero

Jonno

Posted 2016-02-18T09:48:01.867

Reputation: 18 756

Thank you very much ! I think you were first by a few seconds so I'll give it to you :) – Phil Nind – 2016-02-18T10:06:53.900

Can you help with another one...I have used your code above but it is still displaying Y even when the 2 fields are blank...

=IF(P37<=O37/2,"Y",IF(P37>=O37/2,"N","")) – Phil Nind – 2016-02-18T10:08:00.563

@PhilNind That's slightly different because you're comparing them as numbers, and a blank cell = 0 (Hence, 0 <= 0/2, Y). So, now things get messy ;). Try =IF(AND(NOT(ISBLANK(P37)),NOT(ISBLANK(O37)),P37<=O37/2),"Y",IF(AND(NOT(ISBLANK(P37)),NOT(ISBLANK(O37)),P37>=O37/2),"N","")) - basically checking the fields aren't blank as well as doing the comparison. – Jonno – 2016-02-18T10:12:52.940

It is throwing up an error possibly too many brackets – Phil Nind – 2016-02-18T10:57:31.740

@PhilNind Think it's something to do with the formatting in comments, try the amended answer. – Jonno – 2016-02-18T11:05:15.927

Still no dice :/ I appreciate your help massively – Phil Nind – 2016-02-18T11:31:11.637

@PhilNind Really? I just copied and pasted directly from the answer and it worked fine (The one in my comment doesn't though...) – Jonno – 2016-02-18T11:34:44.920

Yep my bad got it working now :) thank you so much – Phil Nind – 2016-02-18T12:02:36.783