If(and statement - 2 conditions - 3 outcomes

JoeRooney

Board Regular
Joined
Nov 27, 2017
Messages
171
Office Version
  1. 365
Hi,

I have the below formula and can’t figure out why it returnsa #N/a instead of the “Policy Not Found”

The "Policy found" and “” are working fine the only problem iswith the false value coming up as #N/a instead of "Policy Not Found"



Any help is greatly appreciated.

=IF(AND(A2="",B2=""),"",IF((A2=B2),"PolicyFound","Policy Not Found"))


Thanks
Joe

 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Does either A2 or B2 contain #N/A
 
Upvote 0
Hi,

Yes it does, now I have another problem, I have amended the columnthat it is looking at (code below) so I no longer receive N/A

=IFNA(VLOOKUP(A2,TWG_File!A:AD,1,0),"Not found")

Is it working except it is returning not found for the blankfields, so is it possible to return

The value
Not found
“” for blanks?

Any help is greatly appreciated.

 
Upvote 0
Hi,
I am not sure I understand your question, are you asking that if the vlookip doesnt get a match you want the value to be blank or "Not Found"
 
Upvote 0
Hi,

Sorry no so if there is a match I want it to return thevalue

If it doesn’t match I want it to return “Not found”

Or if both cells are blank I want it to return a blank,


Example below, instead of Not found in the 3rd rowI would like it to return a blank

Hope that makes sense.

[TABLE="width: 124"]
<tbody>[TR]
[TD="width: 84"] policy_id
[/TD]
[TD="width: 90"] Policy Number
[/TD]
[/TR]
[TR]
[TD="width: 84"] 1111111111
[/TD]
[TD="width: 90"] 1111111111
[/TD]
[/TR]
[TR]
[TD="width: 84"] 2222222222
[/TD]
[TD="width: 90"] Not found
[/TD]
[/TR]
[TR]
[TD="width: 84"]
[/TD]
[TD="width: 90"] Not found

[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Hi,

Yes it does, now I have another problem, I have amended the columnthat it is looking at (code below) so I no longer receive N/A

=IFNA(VLOOKUP(A2,TWG_File!A:AD,1,0),"Not found")

Is it working except it is returning not found for the blankfields, so is it possible to return

The value
Not found
“” for blanks?

Any help is greatly appreciated.

Something like this?

=IFNA(IF(ISBLANK(A2), "", VLOOKUP(A2,TWG_File!A:AD,1,0)),"Not found")
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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