Combine two Vlookup formulas

skpma

New Member
Joined
Mar 3, 2020
Messages
31
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello everyone

I have the following two formulas which work fine, but I want to combine them into one formula.

VBA Code:
=IF(ISERROR(VLOOKUP(G5,'SHEET2'!$C$2:$C$1001,1,FALSE)),FALSE,TRUE)
=IF(ISERROR(VLOOKUP(C5,'SHEET2'!$S$2:$S$1001,1,FALSE)),FALSE,TRUE)

My goal is to place a formula into H5 of sheet1, which first looks for the value G5 (sheet1) in sheet2 (column C) and if found checks if the value in C5 (sheet1) is the same as the value in column S (sheet2).
If yes then it should return TRUE, if no then FALSE.
Either the G5 or the C5 value can occur several times in sheet2, but the combination of the two is unique.
Is there a way to achieve that without VBA?

Thanks in advance for any help.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows
You mean you want both of them to be true to return TRUE? If that is so then:

Say you put 1st formula in A1 and 2nd formula in A2, then in H5 the formula would be:
=(A1*A2)=1
 

Marcelo Branco

MrExcel MVP
Joined
Aug 23, 2010
Messages
16,526
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Maybe...

=COUNTIFS(Sheet2!$C$2:$C$1001,G5,Sheet2!$S$2:$S$1001,C5)>0

M.
 
Solution

jtakw

Well-known Member
Joined
Jun 29, 2014
Messages
6,007
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Without an uploaded sheet to test, I'm winging this:

Excel Formula:
=IF(ISERROR(VLOOKUP(" "&G5&" "&C5&" "," "&C2:C1001&" "&S2:S1001&" ",1,0)),FALSE,TRUE)

PS: may need CSE, I'm not sure.
 

skpma

New Member
Joined
Mar 3, 2020
Messages
31
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows

ADVERTISEMENT

Hey guys,

thank you all for your answers.
Marcelo Branco's version did exactly what I needed.
 

Zot

Well-known Member
Joined
Nov 26, 2020
Messages
1,171
Office Version
  1. 2016
Platform
  1. Windows
Hey guys,

thank you all for your answers.
Marcelo Branco's version did exactly what I needed.
Good to hear that you get what you're looking for
 

Watch MrExcel Video

Forum statistics

Threads
1,130,042
Messages
5,639,728
Members
417,108
Latest member
Thein Than

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
Top