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
 
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

That means the result is false so those two cells are not equal even if they appear to be. Is the sumproduct returning #N/A?
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

results from post #2 & #3's formula

ABC
D
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

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet9

Worksheet Formulas
CellFormula
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))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

I can get this to work on a blank spreadsheet but it isnt working on my main spreadsheet, would it be because the data I am using is imported using =TEXT(**,"DD/MM/YYY")?
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

instead of import using =TEXT(**,"DD/MM/YYY"), try =TEXT(**,"DD/MM/YYY")+0
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

It has worked! Thank you very much :)

=TEXT(**,"DD/MM/YYY")+0
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

this is the modified version


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(--(TEXT($A$1:$A$4,"dd/mm/yyyy")+0=D5),--($B$1:$B$4=A6),$C$1:$C$4)
C8=INDEX(C1:C4,MATCH(1,INDEX((TEXT(A1:A4,"dd/mm/yyyy")+0=D5)*(B1:B4=A6),0),0))
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Based on your opening post:

I want to return Collumn C, first time record.

do not use the SUMPRODUCT. It will add the times together if multiple entries exist.
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

It has worked! Thank you very much :)

=TEXT(**,"DD/MM/YYY")+0

you're welcome.
as Steve suggest the index/match option is more robust
 
Upvote 0
Re: Please help me, I'm stuck :) - VLOOKUP with 2 criterias

Hi Lauren,

It looks like you have your A6 and D5 the wrong way around. D5 should be in the first part of the formula I think.

Owain
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,762
Members
449,048
Latest member
excelknuckles

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