IF Function with 3 conditions

ConfusedAtWork

New Member
Joined
Oct 10, 2017
Messages
3
If a cell says"Y" I want the next cell to have a numerical value, if it says "N" I want it to say "Nil" If it is blank then I want it to stay blank. The first two bits I can do, I just can't do the last.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I'll put this image below so it's easier. If the value in column E says "Y" the 2.5% of the number in column D will appear in column F. If the value is "N", then I want it to say "Nil".

2rr2pw7.png


This is about as far as I have got. I want the rows with blanks in them to stay blank however.

Furthermore, in column G I want the values to be D-F. The cells next to "Nil" however, I would like to stay blank.
 
Upvote 0
=IF(A1="y",1,IF(A1="n","nil",""))

This works but what if someone types M in column A by accident? It wouldn't notice it's been input incorrectly and would return a blank cell.

I would be inclined to add some kind of error message so =IF(E2="","",IF(E2="y",2.5/100*D2,IF(E2="n","Nil","Invalid value in E")))
 
Last edited:
Upvote 0
I would suggest the following formulas -

Paste in column F - =IF(E11="Y",SUM(D11*$E$1),IF(E11="N","Nil",""))
Paste in column G - =IFERROR(SUM(D11-F11),"")

If you want to be sure of "Y" / "N" in column E I would consider a list data validation which will avoid the possibility of typos.
 
Upvote 0
a formula for the second bit?

Sorry, missed that line.

use: =IF(F2="nil","",D2-F2)

Need to ask though... row 12... does that relate to the amount shown on row 11? If so, the formula in this post won't work the way you'd want it to. It's easy enough to create a formula though. Could you paste columns A-C of your spreadsheet? (Substitute sensitive information before posting on here)
 
Upvote 0
EinE, The sum() functions are completely unnecessary. =SUM(A1+B1) returns the same value as =A1+B1 etc.

This being a matter of preference not fact. Even though it wasn't asked for, thank you for sharing your opinion nevertheless. To the poster it is entirely up to you the end user on your preference. Both formulas will work.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top