# Return Blank Cell When Another Cell is Blank in Nested IF Formula

#### rob51852

##### Board Regular
Hi guys,

I have this formula and want to add a condition that if cell D5 is blank the formula should return a blank. At the moment it returns "FALSE" and I can't work out how to do it,

Code:
``=IF(D5="L",ROUND(ABS(IF(D5="L",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2),IF(D5="B",ROUND(ABS(IF(D5="B",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2)))``

Can anyone help?

Thanks

### Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

#### Snakehips

##### Well-known Member
Unless I'm missing something then...

VBA Code:
``=IF(D5="","",IF(D5="L",ROUND(ABS(IF(D5="L",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2),IF(D5="B",ROUND(ABS(IF(D5="B",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2))))``

Hope that helps.

#### jmacleary

##### Well-known Member
Hi there. I have wrapped an extra condition around your formula to return a blank, but I strongly suggest you rework it. At the moment, you have a whole lot of IF statements with no setting if the condition is false - this may lead to other problems.
VBA Code:
``=IF(D5="","",IF(D5="L",ROUND(ABS(IF(D5="L",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2),IF(D5="B",ROUND(ABS(IF(D5="B",(F5-1)*E5)-IF(G5<>"",(H5-1)*G5)-IF(I5<>"",(J5-1)*I5)-IF(K5<>"",(L5-1)*K5)-IF(M5<>"",(N5-1)*M5)-IF(O5<>"",(P5-1)*O5)),2))))``

#### rob51852

##### Board Regular
Thanks guys.

John, column D will only ever contain a blank cell, L or B. My intention was to copy the formula down another column and didn't want a column full of "FALSEs", Would you still suggest reworking it?

Thanks again.

#### jmacleary

##### Well-known Member

If it works for you, then no, but for instance this part of the formula
Rich (BB code):
`` IF(G5<>"",(H5-1)*G5)``
will return False if G5 is blank, the same with your tests for I5, K5, M5, etc. It is always good practice to put something for both outcomes of the test; in this case you would have something like:
Rich (BB code):
``IF(G5<>"",(H5-1)*G5,0)``

#### rob51852

##### Board Regular
Thanks John, I'll do that.

#### jmacleary

##### Well-known Member
You're welcome and thanks for the feedback.

Replies
2
Views
76
Replies
1
Views
399
Replies
11
Views
303
Replies
6
Views
284
Replies
5
Views
115

1,147,451
Messages
5,741,197
Members
423,648
Latest member
steel1968

### 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.

### Which adblocker are you using?

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

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