Avatar of amaru96
amaru96

asked on 

lookup across 2 columns

Hi guys, I'm trying to lookup a value in a cell against 2 columns and if it exists to return "exists" and if not "does not exist" but having much luck.

To try and clarifiy, below is what I'm trying to get to, where columnB returns the result:

ColumnA         ColumnB                ColumnD       ColumnE
Jack                  Exists                       Nick                Daniel
Michael             Does not exist       John                Jack
Jenny                Exists                      Jenny               Bill
Peter                 Does not exist       Lindy                Luke
Paul                  Does not exist       Sophie             Sam
Microsoft Excel

Avatar of undefined
Last Comment
amaru96
Avatar of rspahitz
rspahitz
Flag of United States of America image

What I typically do in cases like this is to add a "dummy" column to handle the lookup.

In this case, you can use column F with this formula:

F1: =D1
F2: =D2
...
Fn: =Dn
F(n+1): =E1
F(n+2): =E2
...

then your formula in column B is:

B1: =If(ISNA(VLOOKUP(A1, F:F, 1, false)),"Does not exist", "Exists")
Avatar of sshah254
sshah254

There's no way to do this with a VLOOKUP function.

If you are willing to do this in VBA, then that is possible.

Ss
Avatar of rspahitz
rspahitz
Flag of United States of America image

You can try this by combining two vlookups:

=IF(AND(ISNA(VLOOKUP(C1,A:A,1,FALSE)),ISNA(VLOOKUP(C1,B:B,1,FALSE))),"Does not exist","Exists")
ASKER CERTIFIED SOLUTION
Avatar of rspahitz
rspahitz
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of amaru96
amaru96

ASKER

Excellent, works great! Thanks rspahitz.
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo