IFS with VLOOKUP, AND/OR function

JAQ1983

New Member
Joined
Aug 16, 2018
Messages
7
Hi All,

I have 2 formula that work individually which I can't seem to merge correctly.

What I want to do is:

If B3=IND & J3 (in tab RM IND)=YES then return the vlookup OR If B3=DOM & J3 (in tab RM DOM)=YES then return the vlookup

These are the 2 individual codes that work:

Code:
=IF(AND($B3="IND",VLOOKUP($J3,'RM IND'!$U$3:$AL$10000,10,0)="Yes"),VLOOKUP($J3,'RM IND'!$U$3:$AR$10000,11,0),0)
=IF(AND($B3="DOM",VLOOKUP($J3,'RM DOM'!$U$3:$AL$10000,10,0)="Yes"),VLOOKUP($J3,'RM DOM'!$U$3:$AR$10000,11,0),0)

I have tried using IFS but this only returns the answer for the 1st statement and not the 2nd?

Code:
=IFS(AND($B3="IND",VLOOKUP($J3,'RM IND'!$U$3:$AL$10000,10,0)="Yes"),VLOOKUP($J3,'RM IND'!$U$3:$AR$10000,11,0),(AND($B3="DOM",VLOOKUP($J3,'RM DOM'!$U$3:$AL$10000,10,0)="Yes")),VLOOKUP($J3,'RM DOM'!$U$3:$AR$10000,11,0))

Can anyone advise where I have gone wrong please? Or a better way of doing it!

Cheers, Jo
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You just put the 2nd formula into the 'value if false' of the 1st formula:

=IF(AND($B3="IND",VLOOKUP($J3,'RM IND'!$U$3:$AL$10000,10,0)="Yes"),VLOOKUP($J3,'RM IND'!$U$3:$AR$10000,11,0),IF(AND($B3="DOM",VLOOKUP($J3,'RM DOM'!$U$3:$AL$10000,10,0)="Yes"),VLOOKUP($J3,'RM DOM'!$U$3:$AR$10000,11,0),0))
 
Upvote 0
You could also make use of patterns and do something like this:

=IFERROR(IF(OR(B$3={"IND","DOM"}),IF(VLOOKUP($J3,INDIRECT("'RM " & B$3 & "'!$U$3:$AL$10000"),10,0)="Yes",VLOOKUP($J3,INDIRECT("'RM " & B$3 & "'!$U$3:$AR$10000"),11,0),0),0),0)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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