INDEX MATCH Function Help

jeffj13

New Member
Joined
Jun 25, 2015
Messages
13
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am working with the a data set that is a schedule that shows break and lunch times. What I am trying to accomplish is listing all of the agents in column C (snippet at the bottom) and listing their Break 1, Lunch and Break 2 in column L in adjacent rows, like this:

AgentBreak 1LunchBreak 2
XYZ, Amber9:00 AM12:00 PM2:30 PM

I am extracting the Agent name in column C with a FILTER function and ignoring blank cells into another worksheet. My attempt to extract the first break time has failed with my formula below. Any idea what I have done wrong or if this can even be done using my methodology? Thank you in advance!
1707952576740.png


1707952113474.png
 

Attachments

  • 1707952078825.png
    1707952078825.png
    26.3 KB · Views: 5

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Perhaps you can use the Filter function to get the rest of the data as well using something like this
Excel Formula:
=FILTER(H6:H9,G6:G9=B5)


1707956137541.png
 

Attachments

  • 1707956131876.png
    1707956131876.png
    11.7 KB · Views: 3
Upvote 0
Your original formula didn't work because the agent name and the time descriptions are not on the same line. If you know that the descriptions will always be in the same relative location (i.e. Break 1 is always 2 rows below the name), you could fix up your formula by offsetting the ranges. Here are a couple other options though:

Book1
ABCDE
1
2
3NameBreak 1 - 10 hourLunchBreak 2Notes
4XYZ, Amber9:00 AM12:00 PM2:30 PM
5ABC, Ed9:15 AM1:00 PM2:45 PM
6STU, Mae11:00 AM11:30 PM4:30 PM
7
8
9NameBreak 1 - 10 hourLunchBreak 2Notes
10XYZ, Amber9:00 AM12:00 PM2:30 PM
11ABC, Ed9:15 AM1:00 PM2:45 PM
12STU, Mae11:00 AM11:30 PM4:30 PM
Sheet15
Cell Formulas
RangeFormula
A4:A6,A10:A12A4=LET(a,UNIQUE(csv!C1:C1000),FILTER(a,(a<>"")*(a<>"Agent")))
B4:D6B4=INDEX(csv!$L$8:$L$290,MATCH($A4,csv!$C$8:$C$292,0)+COLUMNS($A:B))
B10:D12B10=VLOOKUP(B$3,INDEX(csv!$K$1:$K$1000,MATCH($A10,csv!$C$1:$C$1000,0)):csv!$L$1000,2,0)
Dynamic array formulas.


The top set assumes the 3 times are always in the same relative positions. The second set searches for the agent name first, then does a VLOOKUP for the description in column K starting at the row the agent was found in. So the descriptions don't have to be in the same order, but there could be an issue if a given description is not found, since it might be found further down in the next agent's area.

Let us know if either of these might work for you.
 
Upvote 0
The second set searches for the agent name first, then does a VLOOKUP for the description in column K starting at the row the agent was found in. So the descriptions don't have to be in the same order, but there could be an issue if a given description is not found, since it might be found further down in the next agent's area.
That was my guess, that the data might not line up the same way.

ABCD
1
2
3NameBreak 1 - 10 hourLunchBreak 2
4XYZ, Amber9:00 AM12:00 PM-
5ABC, Ed9:15 AM1:00 PM2:45 PM
6STU, Mae11:00 AM11:30 PM4:30 PM
Sheet1
Cell Formulas
RangeFormula
A4:A6A4=LET(a,UNIQUE(csv!C1:C1000),FILTER(a,(a<>"")*(a<>"Agent")))
B4:D6B4=IFERROR(VLOOKUP(B$3:D$3,IF(SCAN(,csv!$C$1:$C$1000,LAMBDA(a,b,IF(b="",a,b)))=A4,csv!K$1:L$1000),2,),"-")
Dynamic array formulas.

ABCDEFGHIJKL
1
2
3XYZ, AmberBreak 1 - 10 hour9:00 AM
4Lunch12:00 PM
5ABC, Ed
6
7Break 1 - 10 hour9:15 AM
8
9Lunch1:00 PM
10
11Break 22:45 PM
12
13
14STU, Mae
15Break 24:30 PM
16Lunch11:30 PM
17
18Break 1 - 10 hour11:00 AM
csv
 
Upvote 0
Your original formula didn't work because the agent name and the time descriptions are not on the same line. If you know that the descriptions will always be in the same relative location (i.e. Break 1 is always 2 rows below the name), you could fix up your formula by offsetting the ranges. Here are a couple other options though:

Book1
ABCDE
1
2
3NameBreak 1 - 10 hourLunchBreak 2Notes
4XYZ, Amber9:00 AM12:00 PM2:30 PM
5ABC, Ed9:15 AM1:00 PM2:45 PM
6STU, Mae11:00 AM11:30 PM4:30 PM
7
8
9NameBreak 1 - 10 hourLunchBreak 2Notes
10XYZ, Amber9:00 AM12:00 PM2:30 PM
11ABC, Ed9:15 AM1:00 PM2:45 PM
12STU, Mae11:00 AM11:30 PM4:30 PM
Sheet15
Cell Formulas
RangeFormula
A4:A6,A10:A12A4=LET(a,UNIQUE(csv!C1:C1000),FILTER(a,(a<>"")*(a<>"Agent")))
B4:D6B4=INDEX(csv!$L$8:$L$290,MATCH($A4,csv!$C$8:$C$292,0)+COLUMNS($A:B))
B10:D12B10=VLOOKUP(B$3,INDEX(csv!$K$1:$K$1000,MATCH($A10,csv!$C$1:$C$1000,0)):csv!$L$1000,2,0)
Dynamic array formulas.


The top set assumes the 3 times are always in the same relative positions. The second set searches for the agent name first, then does a VLOOKUP for the description in column K starting at the row the agent was found in. So the descriptions don't have to be in the same order, but there could be an issue if a given description is not found, since it might be found further down in the next agent's area.

Let us know if either of these might work for you.
Thanks much for helping me with this, I appreciate your time.

The times could fall in different positions. The other problem I have is Break 1-10 hour is not always labeled that way (the other Break Category is "Break 1", but I can work around that with adding another break category with the appropriate name. I tried the second formula with the VLOOKUP, it seems to work for the first two but then is returning different times for the next 2 agents and no time for the remaining 4 agents. I think the break categories are the problem, but not sure why it returns a value if it isn't finding an exact match.

Also, I had to tweak my formula to bring in the agent name. I only want to bring in agents where in column J they have "ERS OUTBOUND DISPATCH" in the same row. So I am using =FILTER(csv!$C:$C,csv!$J:$J="ERS OUTBOUND DISPATCH")
1708021338293.png


1708021377878.png
 
Upvote 0
How about ...

ABCD
1
2
3NameBreak 1LunchBreak 2
4XYZ, Amber9:00 AM12:00 PM-
5ABC, Ed9:15 AM1:00 PM2:45 PM
6STU, Mae11:00 AM11:30 PM4:30 PM
Sheet1
Cell Formulas
RangeFormula
A4:A6A4=FILTER(csv!C1:C1000,csv!J1:J1000="ERS OUTBOUND DESPATCH")
B4:D6B4=IFERROR(VLOOKUP(B$3:D$3&"*",IF(SCAN(,csv!$C$1:$C$1000,LAMBDA(a,b,IF(b="",a,b)))=A4,csv!K$1:L$1000),2,),"-")
Dynamic array formulas.

ABCDEFGHIJKL
1
2
3XYZ, AmberERS OUTBOUND DESPATCHBreak 1 - 10 hour9:00 AM
4Lunch12:00 PM
5ABC, EdERS OUTBOUND DESPATCH
6
7Break 1 - 10 hour9:15 AM
8
9Lunch1:00 PM
10
11Break 2 - blah2:45 PM
12
13Some randomLunch blah blah1:15 PM
14
15STU, MaeERS OUTBOUND DESPATCH
16Break 24:30 PM
17Lunch11:30 PM
18
19Break 111:00 AM
csv
 
Upvote 0
Solution
How about ...

ABCD
1
2
3NameBreak 1LunchBreak 2
4XYZ, Amber9:00 AM12:00 PM-
5ABC, Ed9:15 AM1:00 PM2:45 PM
6STU, Mae11:00 AM11:30 PM4:30 PM
Sheet1
Cell Formulas
RangeFormula
A4:A6A4=FILTER(csv!C1:C1000,csv!J1:J1000="ERS OUTBOUND DESPATCH")
B4:D6B4=IFERROR(VLOOKUP(B$3:D$3&"*",IF(SCAN(,csv!$C$1:$C$1000,LAMBDA(a,b,IF(b="",a,b)))=A4,csv!K$1:L$1000),2,),"-")
Dynamic array formulas.

ABCDEFGHIJKL
1
2
3XYZ, AmberERS OUTBOUND DESPATCHBreak 1 - 10 hour9:00 AM
4Lunch12:00 PM
5ABC, EdERS OUTBOUND DESPATCH
6
7Break 1 - 10 hour9:15 AM
8
9Lunch1:00 PM
10
11Break 2 - blah2:45 PM
12
13Some randomLunch blah blah1:15 PM
14
15STU, MaeERS OUTBOUND DESPATCH
16Break 24:30 PM
17Lunch11:30 PM
18
19Break 111:00 AM
csv
Brilliant! Thank you! Now to try and understand your solution...😁
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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