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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

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