Multiple Scenario VLookup

odonovanc

Board Regular
Joined
Oct 4, 2017
Messages
60
Office Version
  1. 365
What is the formula if I want to do a vlookup and there are multiple scenarios.

I want to lookup say A1 in sheet 2 range A1:F100. If there is an X in column 2 I want to return the value "Text". OR If there is an X in column 3 then I want it to return "Different Text", and if neither column has an X I want it to remain blank "". It will never happen that there is an X in both. Can someone help me write this formula? Thanks.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
How about
=IF(COUNTIFS(sheet2!A:A,A2,sheet2!B:B,"X")>0,"Text",IF(COUNTIFS(sheet2!A:A,A2,sheet2!C:C,"X")>0,"Different text",""))
 
Upvote 0
How about
=IF(COUNTIFS(sheet2!A:A,A2,sheet2!B:B,"X")>0,"Text",IF(COUNTIFS(sheet2!A:A,A2,sheet2!C:C,"X")>0,"Different text",""))

Don't think I was clear. I need to lookup cell A1 in sheet 1 in sheet 2 Range A1:F100. If there is an X in column 2 of sheet 2 I want to return the value "Text". OR If there is an X in column 3 of sheet 2 then I want it to return "Different Text", and if neither column has an X I want it to remain blank "". It will never happen that there is an X in both. Thanks.
 
Upvote 0
Let's say cell A1 in sheet 1 is a city name. Chicago. I need to lookup that city in sheet 2 and write "Text" or "different Text" or leave blank based on whether one of those columns after the city column (Column A in sheet 2) have an X or if they are blank. I hope that is more clear.
 
Upvote 0
Hi Odonovanc,

Try
=IF(ISNA(VLOOKUP("X",Sheet2!$B$1:$B$100,1,0)),IF(ISNA(VLOOKUP("X",Sheet2!$C$1:$C$100,1,0)),"","Different text"),"Text")
 
Upvote 0
That's what my formula does. :)
 
Upvote 0
+Fluff New.xlsm
ABC
1LocationIn Use?Latitude
2WiltshireYes51.11
3WarwickYes53.24
4TeignbridgeYes54.29
5St AlbansYes50.74
6South DerbyshireYes53.75
7SedgemoorX52.30
8RichmondshireYes53.83
9North DevonX53.87
10LiverpoolYesX
11KirkleesYes51.26
12Kingston upon HullYesX
13HyndburnYes51.13
14ErewashYes53.79
15DoverYes53.07
16ChesterYes52.97
17Cheshire EastYes53.59
18CalderdaleYesX
19BuryX51.80
20BradfordX51.32
sheet2


+Fluff New.xlsm
AB
1Location
2BradfordText
3BuryText
4CalderdaleDifferent text
5Cheshire East 
6Chester 
7Dover 
8Erewash 
9Hyndburn 
10Kingston upon HullDifferent text
11Kirklees 
12LiverpoolDifferent text
13North DevonText
14Richmondshire 
15SedgemoorText
16South Derbyshire 
17St Albans 
18Teignbridge 
19Warwick 
20Wiltshire 
Sheet1
Cell Formulas
RangeFormula
B2:B20B2=IF(COUNTIFS(sheet2!A:A,A2,sheet2!B:B,"X")>0,"Text",IF(COUNTIFS(sheet2!A:A,A2,sheet2!C:C,"X")>0,"Different text",""))
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,578
Members
449,174
Latest member
chandan4057

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