Using Index and Match, returning duplicates.

monolithicjoe

New Member
Joined
Sep 26, 2017
Messages
2
Hello,

I am attempting to auto populate a list based on times. I am using this formula and it works great if the shift times are different =INDEX(Sheet1!A:A,MATCH("XXXXXX",Sheet1!C:C, 0))

However, when they are the same, i.e =INDEX(Sheet1!A:A,MATCH("7:00A - 3:30P",Sheet1!C:C, 0)) it will obviously fill in the first name it finds.

Also the reason why all of rows A and C are selected is because the names and times do not always appear in the same row.

Example:
Doe, John7:00A - 3:30P
Smith, John7:00A - 3:30P
Rodger, John7:00A - 3:30P

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Will show as:
Doe, John
Doe, John
Doe, John

But would like:
Doe, John
Smith, John
Rodger, John


<colgroup><col></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi,

try something like this:


Book1
ABCDE
1Doe, John7:00A - 3:30P7:00A - 3:30P
2Smith, John7:00A - 3:30PDoe, John
3Rodger, John7:00A - 3:30PSmith, John
4Rodger, John
5
Sheet1
Cell Formulas
RangeFormula
E2{=IF(ISERROR(INDEX($A$1:$A$3,SMALL(IF($B$1:$B$3=$E$1,ROW($A$1:$A$3)),ROW(1:1)),1)),"",INDEX($A$1:$A$3,SMALL(IF($B$1:$B$3=$E$1,ROW($A$1:$A$3)),ROW(1:1)),1))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Hi,

try something like this:

ABCDE
1Doe, John7:00A - 3:30P7:00A - 3:30P
2Smith, John7:00A - 3:30PDoe, John
3Rodger, John7:00A - 3:30PSmith, John
4Rodger, John
5

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

Array Formulas
CellFormula
E2{=IF(ISERROR(INDEX($A$1:$A$3,SMALL(IF($B$1:$B$3=$E$1,ROW($A$1:$A$3)),ROW(1:1)),1)),"",INDEX($A$1:$A$3,SMALL(IF($B$1:$B$3=$E$1,ROW($A$1:$A$3)),ROW(1:1)),1))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Thanks for the help! But in order to apply this for my needs I would need it to read off one sheet so it fills into another. I tried to edit it so it references the data in Sheet1 but it does not fill in anything.
 
Upvote 0
look at this:


Book1
A
17:00A - 3:30P
2Doe, John
3Smith, John
4Rodger, John
Sheet2
Cell Formulas
RangeFormula
A2{=IF(ISERROR(INDEX(Sheet1!$A$1:$A$3,SMALL(IF(Sheet1!$B$1:$B$3=$A$1,ROW(Sheet1!$A$1:$A$3)),ROW($A1:$A1)),1)),"",INDEX(Sheet1!$A$1:$A$3,SMALL(IF(Sheet1!$B$1:$B$3=$A$1,ROW(Sheet1!$A$1:$A$3)),ROW($A1:$A1)),1))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
Sheet1 (data)

Row\Col
A​
B​
1​
2​
Doe, John7:00A - 3:30P
3​
4​
Smith, John7:00A - 3:30P
5​
Rodger, John7:00A - 3:30P
6​
Del Monte, Linda9:00A - 4:30P
7​

Sheet2 (processing)

Row\Col
A​
1​
7:00A - 3:30P
2​
3​
3​
4​
Doe, John
5​
Smith, John
6​
Rodger, John
7​

In A2 just enter:

=COUNTIFS(Sheet1!$B$2:$B$5,A$1)

In A4 control+shift+enter, not just enter, and copy down:

=IF(ROWS($A$4:A4)>$A$2,"",INDEX(Sheet1!$A$2:$A$5,SMALL(IF(Sheet1!$B$2:$B$5=$A$1,ROW(Sheet1!$A$2:$A$5)-ROW(Sheet1!$A$2)+1),ROWS($A$4:A4))))
 
Upvote 0

Forum statistics

Threads
1,218,127
Messages
6,140,636
Members
450,300
Latest member
nashetho

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