Lookup if two conditions are met!

MASOODAHMAD

Board Regular
Joined
Mar 28, 2012
Messages
105
Platform
  1. MacOS
Hello,

I'm trying to get this to work. I tried the vlookup, combination of Match & Index, but none helped me to achieve the desired output. I'm missing something.

Here is my lookup table1 with "Holiday" details in the third column. Instead of "Holiday", the column might contains other text/value.

Table1:
EcodeDateDay
EKCS-12471/5/2018, Tuesday
EKCS-11411/5/2018, Tuesday
EKCS-03661/5/2018, Tuesday
EKCS-13171/5/2018, Tuesday
EKCS-1247
7/5/2018, Monday
Holiday
EKCS-11417/5/2018, Monday
Holiday
EKCS-03667/5/2018, Monday
Holiday
EKCS-13177/5/2018, MondayHoliday
EKCS-12478/5/2018, Tuesday
EKCS-11418/5/2018, Tuesday
EKCS-03668/5/2018, Tuesday
EKCS-13178/5/2018, Tuesday
EKCS-12478/5/2018, Tuesday

<tbody>
</tbody>
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 12pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Calibri, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { text-align: left; border: 0.5pt solid windowtext; }.xl64 { border: 0.5pt solid windowtext; }.xl65 { font-weight: 700; }.xl66 { text-align: left; border: 0.5pt solid windowtext; background: yellow none repeat scroll 0% 0%; }.xl67 { border: 0.5pt solid windowtext; background: yellow none repeat scroll 0% 0%; }</style>

Below is the table2 where I want to extract the values from the table1 above.

If values in column A and B (table2) matches with the values in column A and B (table1), then the corresponding column C (table2) should get the value from column C of table 1. Also note that Ecode is repeated in column A.

For example, in the table below, the Red highlighted needs to have the "Holiday" data in column C.

Table2:
EcodeDateDayEcodeDateDay
EKCS-01232/6/2018, SaturdayEKCS-01232/6/2018, Saturday
EKCS-124613/5/2018, SundayEKCS-124613/5/2018, Sunday
EKCS-048221/5/2018, MondayEKCS-048221/5/2018, Monday
EKCS-022929/5/2018, TuesdayEKCS-022929/5/2018, Tuesday
EKCS-036215/5/2018, TuesdayEKCS-036215/5/2018, Tuesday
EKCS-03668/5/2018, TuesdayEKCS-03668/5/2018, Tuesday
EKCS-1317
7/5/2018, Monday



EKCS-13177/5/2018, MondayHoliday
EKCS-13178/5/2018, TuesdayEKCS-13178/5/2018, Tuesday
EKCS-106223/5/2018, WednesdayEKCS-106223/5/2018, Wednesday
EKCS-12478/5/2018, TuesdayEKCS-12478/5/2018, Tuesday
EKCS-118825/5/2018, FridayEKCS-118825/5/2018, Friday
EKCS-068331/5/2018, ThursdayOUTPUT >>EKCS-068331/5/2018, Thursday
EKCS-13066/6/2018, WednesdayEKCS-13066/6/2018, Wednesday
EKCS-03661/5/2018, TuesdayEKCS-03661/5/2018, Tuesday
EKCS-12478/5/2018, TuesdayEKCS-12478/5/2018, Tuesday
EKCS-1141
7/5/2018, Monday



EKCS-11417/5/2018, MondayHoliday
EKCS-03319/5/2018, WednesdayEKCS-03319/5/2018, Wednesday
EKCS-135811/5/2018, FridayEKCS-135811/5/2018, Friday
EKCS-12354/6/2018, MondayEKCS-12354/6/2018, Monday
EKCS-13171/5/2018, TuesdayEKCS-13171/5/2018, Tuesday
EKCS-12473/5/2018, ThursdayEKCS-12473/5/2018, Thursday
EKCS-11411/5/2018, TuesdayEKCS-11411/5/2018, Tuesday
EKCS-0366
7/5/2018, Monday



EKCS-03667/5/2018, MondayHoliday
EKCS-12477/5/2018, Monday



EKCS-12477/5/2018, MondayHoliday
EKCS-09497/5/2018, MondayEKCS-09497/5/2018, Monday
EKCS-091127/5/2018, SundayEKCS-091127/5/2018, Sunday

<tbody>
</tbody>
<style>table { }td { padding-top: 1px; padding-right: 1px; padding-left: 1px; color: black; font-size: 12pt; font-weight: 400; font-style: normal; text-decoration: none; font-family: Calibri, sans-serif; vertical-align: bottom; border: medium none; white-space: nowrap; }.xl63 { text-align: left; border: 0.5pt solid windowtext; }.xl64 { border: 0.5pt solid windowtext; }.xl65 { font-weight: 700; }.xl66 { text-align: left; border: 0.5pt solid windowtext; background: yellow none repeat scroll 0% 0%; }.xl67 { border: 0.5pt solid windowtext; background: yellow none repeat scroll 0% 0%; }.xl68 { border: 0.5pt solid windowtext; }</style>

Thanks in advance.
 
Last edited:
Hi Marcelo,

Thanks again for your inputs. Your formula did worked if the tables are identical, but don't if they are not. The Employee code in Column A could be in Random order, therefore, needs something which will look and verify the Employee Code and date from the three table and then come up with the results.

Just like we did in the previous scenario by matching to conditions using IF.

Ok, then you should use INDEX(table,match,match)
Something like
B2 copied across and down
=IF(INDEX(Sheet2!$A$1:$K$10,MATCH($A2,Sheet2!$A$1:$A$10,0),MATCH(B$1,Sheet2!$A$1:$K$1,0))="L","L",INDEX(Sheet1!$A$1:$K$10,MATCH($A2,Sheet1!$A$1:$A$10,0),MATCH(B$1,Sheet1!$A$1:$K$1,0)))

M.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
You're a genius Marcelo,

I think the formula worked, I'll test it further by tomorrow.

Thanks for all your support.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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