VLOOKUP when more than 1 data matches

goble

New Member
Joined
Oct 7, 2010
Messages
48
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I have "Sheet1"

CompanyScheduleDate
Microsoft2 hours (10h00-12h00)13-Oct-22
IBM4 hours (09h00-13h00)15-Oct-22
Dell3 hours (13h00-16h00)13-Oct-22

Then "Sheet2",

=TODAY()=A1+1=B1+1=C1+1
=VLOOKUP(A1,Sheet1!A1:C4,????,FALSE)=VLOOKUP(B1,Sheet1!A1:C4,????,FALSE)=VLOOKUP(C1,Sheet1!A1:C4,????,FALSE)=VLOOKUP(D1,Sheet1!A1:C4,????,FALSE)

The question marks are what I don't know what to include. Or may be this is the wrong approach :unsure:

Assuming we are the 13-Oct-22 today, The results of "Sheet 2" am looking for is hereunder. The idea is to get a planning on sheet2 (from sheet1) as from Today the 13-Oct-22. However VLOOKUP may find more than 1 matched data, then it should have other results on other rows.

"Sheet2":

13-Oct-2214-Oct-2215-Oct-2216-Oct-22
Microsoft - 2 hours (10h00-12h00)IBM - 4 hours (09h00-13h00)
Dell - 3 hours (13h00-16h00)

Thanks for any hint ! ;)
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try this.

goble.xlsm
ABC
1CompanyScheduleDate
2Microsoft2 hours (10h00-12h00)13-Oct-22
3IBM4 hours (09h00-13h00)15-Oct-22
4Dell3 hours (13h00-16h00)13-Oct-22
5
Sheet1


Cell Formulas
RangeFormula
A1A1=TODAY()
B1:C1B1=A1+1
A2:C4A2=IFERROR(INDEX(Sheet1!$A:$A,AGGREGATE(15,6,ROW(Sheet1!$A$2:$A$100)/(Sheet1!$C$2:$C$100=A$1),ROWS(A$2:A2))),"")
 
Upvote 0
Upvote 0
A last thing, If I have a another sheet called sheet11 for example that have the same data format as described in Sheet1 (but with different data).

I want sheet 2 to display as well for this sheet11 For instance :
Sheet2 row2-6 : Display data from sheet1 from Formula as you provided >> this is OK
Sheet2 row7-11: Display data from sheet11 (starting at 2nd row of sheet11)
 
Upvote 0
Same Sheet1 as before.

Sheet11
goble.xlsm
ABC
1CompanyScheduleDate
2Co 1Sch 113-Oct-22
3Co 2Sch 214-Oct-22
4Co 3Sch 313-Oct-22
5Co 4Sch 415-Oct-22
Sheet11


New Sheet2 formulas

Cell Formulas
RangeFormula
A1A1=TODAY()
B1:C1B1=A1+1
A2:C6A2=IFERROR(INDEX(Sheet1!$A:$A,AGGREGATE(15,6,ROW(Sheet1!$A$2:$A$100)/(Sheet1!$C$2:$C$100=A$1),ROWS(A$2:A2)))&" - "&INDEX(Sheet1!$B:$B,AGGREGATE(15,6,ROW(Sheet1!$B$2:$B$100)/(Sheet1!$C$2:$C$100=A$1),ROWS(A$2:A2))),IFERROR(INDEX(Sheet11!$A:$A,AGGREGATE(15,6,ROW(Sheet11!$A$2:$A$100)/(Sheet11!$C$2:$C$100=A$1),ROWS(A$2:A2)-COUNTIF(Sheet1!$C$2:$C$100,A$1)))&" - "&INDEX(Sheet11!$B:$B,AGGREGATE(15,6,ROW(Sheet11!$B$2:$B$100)/(Sheet11!$C$2:$C$100=A$1),ROWS(A$2:A2)-COUNTIF(Sheet1!$C$2:$C$100,A$1))),""))
 
Upvote 0
Solution
Hello,

Perfection again !

Always amazed by the quality of replies from Excel gurus here ! Straight to the point ! :cool:
 
Upvote 0
Hello,

My excel sheets have got some new contents and I wanted to add some outputs.

Sheet 1 is called : 'Invoice FPB'
Starting at Row1 Column A
CompanyDate InvoicedServicesDate 1Date 2Date 3Date 4Date 5Date 6Date 7InvoicedPayment ReceivedPayment DueInvoice No.Place
Client 1
Don't Care
20h-22h
29-Jun-23​
Don't Care
Don't Care
Don't Care
Don't Care
Location 1
Client 2
Don't Care
19h-23h
30-Jun-23​
Don't Care
Don't Care
Don't Care
Don't Care
Location 2

Sheet 1 is called : 'Invoice KPB'
Starting at Row1 Column A
CompanyDate InvoicedServicesDatesInvoicedPayment ReceivedPayment DueInvoice No.TypePlace
Client ADon't Care18h-22h
29-Jun-23​
Don't Care
Don't Care
Don't Care​
Don't CareDon't Care
Location A​
Client B
Don't Care
17h-00h30-Jun-23
Don't Care

Don't Care
Don't Care​
Don't CareDon't Care
Location B​

Here's the formula I have adapted (as per your solution) and which is working.

=IFERROR(@INDEX('Invoice FPB'!$A:$A,AGGREGATE(15,6,ROW('Invoice FPB'!$A$2:$A$10014)/('Invoice FPB'!$D$2:$D$10014=A$1),ROWS(A$2:A2)))&" - "&@INDEX('Invoice FPB'!$C:$C,AGGREGATE(15,6,ROW('Invoice FPB'!$C$2:$C$10014)/('Invoice FPB'!$D$2:$D$10015=A$1),ROWS(A$2:A2))),IFERROR(@INDEX('Invoice KPB'!$A:$A,AGGREGATE(15,6,ROW('Invoice KPB'!$A$2:$A$10000)/('Invoice KPB'!$D$2:$D$10000=A$1),ROWS(A$2:A2)-COUNTIF('Invoice FPB'!$D$2:$D$10014,A$1)))&" - "&@INDEX('Invoice KPB'!$C:$C,AGGREGATE(15,6,ROW('Invoice KPB'!$B$2:$B$10000)/('Invoice KPB'!$D$2:$D$10000=A$1),ROWS(A$2:A2)-COUNTIF('Invoice FPB'!$D$2:$D$10014,A$1))),""))

Actual Output :
29-June-202330-June-2023
Client 1 - 20h-22hClient 2 - 19h-23h
Client A - 18h-22hClient B - 17h-00h

New output that I need:
29-June-202330-June-2023
Client 1 - 20h-22h - Location 1Client 2 - 19h-23h - Location 2
Client A - 18h-22h - Location AClient B - 17h-00h - Location B
 
Upvote 0

Forum statistics

Threads
1,221,522
Messages
6,160,308
Members
451,637
Latest member
hvp2262

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