If statement with VLOOKUP

holykimura

New Member
Joined
Apr 29, 2012
Messages
24
Hi could any one tell me what is wrong with the below:

=IFERROR(IF(AND(U5="",U5<>"A"),(VLOOKUP(T5,Belt,2,FALSE)-VLOOKUP(D5,Belt,2,FALSE)),(VLOOKUP(U5,Belt,2,FALSE)-VLOOKUP(D5,Belt,2,FALSE))),"Absent")

I want it to look at Cell U5 to see if it is blank or contains the letter A and if so carry out either of the two VLOOKUP calculations, where the first Vlookup calculation is executed if both of the conditions in the IF statement are met otherwise carry out the second calculation. However it only seems to work if cell U5 contains the letter A but not if it is blank. What am I doing wrong?

Thanks in advance.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Your first vlookup will only ever trigger if U5 is blank. Sounds like you need an OR rather than an AND.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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