Nested IF/AND returning 0 instead of specified blank

learningdaly

New Member
Joined
Mar 25, 2014
Messages
10
My formula is returning a 0 when true instead of being blank as specified. If I designate a value other than "blank" (i.e. "A Word") it still returns a 0. What am I doing wrong?


=IF(AND(CBAuditType="PHYSICAL",TxtInsuredName=""),"",TxtInsuredName)


If you need more information to help let me know!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Are CBAuditType and TxtInsuredName named ranges?
 
Upvote 0
They are named cells. CBAuditType uses data validation to select from a list. The user can enter any text into the TxtInsuredName cell.
 
Upvote 0
Test the cells individually to find the culprait.
What do these return?

=TxtInsuredName=""
=CBAuditType="PHYSICAL"
 
Upvote 0
Glad to help.

What exactly was the problem/solution?
Other readers with similar issue might be interested.
 
Upvote 0
Under conditions where:
CBAuditType<>"PHYSICAL", and TxtInsuredName="" the OPs formula will return a 0 b/c the False condition of his formula returns TxtInsuredName which is a blank cell ("") that Excel reads as zero. One way around the 0 is this:

=IF(AND(CBAuditType="PHYSICAL",TxtInsuredName=""),"",Text(TxtInsuredName, "@"))

Edit: After testing, I find the formula modification I suggested in the line above does not work - the formula still returns a text "0".
 
Last edited:
Upvote 0
Assuming txtInsuredName will always be a text string (including ""), then this avoids the "0"
Code:
=IF(AND(CBAuditType="PHYSICAL",TxtInsuredName=""),"",Text(TxtInsuredName, ""))
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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