VLOOKUP with 2 criterias

LaurenHancy

Board Regular
Joined
Aug 5, 2010
Messages
179
Hi All,

I am having a real problem with return the time of a cell using 2 criterias:

This is the data table:

A B C D

1 02/01/19 John 08:16 06:40
2 03/01/19 Bob 08:20 05:30
3 04/05/19 John 09:45 06:44
4 04/03/19 David 08:20 07:55

I am wanting to do an index search as per the following into each date collumn I have. As the referance collumns are not underneath each other, my VLOOKup doesnt work, it just returns #N/A.

=VLOOKUP(A6&D5, RAW_UserAvSum_DATA, 3,FALSE)

A6 = Name
D5 = Date

I want to return Collumn C, first time record.

Thank you for helping me x
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Try like this:

=INDEX(C1:C4,MATCH(1,INDEX((A1:A4=D5)*(B1:B4=A6),0),0))
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

not a vlookup() solution


Book1
ABCD
102/01/2019John08:1606:40
203/01/2019Bob08:2005:30
304/05/2019John09:4506:44
404/03/2019David08:2007:55
5
604/05/2019John09:45
Sheet9
Cell Formulas
RangeFormula
C6=SUMPRODUCT(--($A$1:$A$4=A6),--($B$1:$B$4=B6),$C$1:$C$4)
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

not a vlookup() solution

ABCD
John
Bob
John
David
John

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: right"]02/01/2019[/TD]

[TD="align: right"]08:16[/TD]
[TD="align: right"]06:40[/TD]

[TD="align: center"]2[/TD]
[TD="align: right"]03/01/2019[/TD]

[TD="align: right"]08:20[/TD]
[TD="align: right"]05:30[/TD]

[TD="align: center"]3[/TD]
[TD="align: right"]04/05/2019[/TD]

[TD="align: right"]09:45[/TD]
[TD="align: right"]06:44[/TD]

[TD="align: center"]4[/TD]
[TD="align: right"]04/03/2019[/TD]

[TD="align: right"]08:20[/TD]
[TD="align: right"]07:55[/TD]

[TD="align: center"]5[/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

[TD="align: center"]6[/TD]
[TD="align: right"]04/05/2019[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=E2EFDA]#E2EFDA[/URL] , align: right"]09:45[/TD]
[TD="align: right"][/TD]

</tbody>
Sheet9

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<thead>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH="width: 10px"]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
</thead><tbody>[TR]
[TH="width: 10px, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]C6[/TH]
[TD="align: left"]=SUMPRODUCT(--($A$1:$A$4=A6),--($B$1:$B$4=B6),$C$1:$C$4)[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

That has a bit of a problem should there be two entries for the same person on the same date.
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Hi,

A quick and easy way to achieve this would be to insert a column before column A and enter =CONCATENATE(D2,C2). This would be C2 and B2 in your table above but I have inserted a column. So that covers the what you are looking up.

Then change you lookup to: =VLOOKUP(A6&D5,RAW_UserAvSum_DATA, 5,FALSE)

That should do it.

Hope that helps
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Hi All,

I have tried all of the above but it doesnt seem to work. I have tried concertrating 2 collumns then using Vlookup function, also tried Sum Product, but nothing seems to work all I get is #N/A.
 
Last edited by a moderator:
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Find the row where you expect the solution to be found. Then check that cell A6 equals the name and cell D5 equals the date of that same row.

eg.

=A6=B1

and

=D5=A1

because at least one must be false.
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Hi Steve,

The result returns 00:00:00

I am using the following forular to be exact:

=SUMPRODUCT(--('RAW - UserAvSummary'!$B$8:$B$5000=A6),--('RAW - UserAvSummary'!$A$8:$A$5000=D5),'RAW - UserAvSummary'!$C$8:$C$5000)

A6 = Name
D5 = Date

I am not too sure what I am doing wrtong?
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

results from post #2 & #3's formula


Book1
ABCD
102/05/2019John08:1606:40
203/01/2019Bob08:2005:30
304/05/2019John09:4506:44
404/03/2019David08:2007:55
504/05/2019
6John09:45
7
809:45
Sheet9
Cell Formulas
RangeFormula
C6=SUMPRODUCT(--($A$1:$A$4=D5),--($B$1:$B$4=A6),$C$1:$C$4)
C8=INDEX(C1:C4,MATCH(1,INDEX((A1:A4=D5)*(B1:B4=A6),0),0))
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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