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:
[TABLE="width: 289"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD]7:00A - 3:30P[/TD]
[/TR]
[TR]
[TD]Smith, John[/TD]
[TD][/TD]
[TD]7:00A - 3:30P[/TD]
[/TR]
[TR]
[TD]Rodger, John[/TD]
[TD][/TD]
[TD]7:00A - 3:30P
[/TD]
[/TR]
</tbody>[/TABLE]

Will show as:
[TABLE="width: 104"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Doe, John[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[/TR]
[TR]
[TD]Doe, John

But would like:
[TABLE="width: 103"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Doe, John[/TD]
[/TR]
[TR]
[TD]Smith, John[/TD]
[/TR]
[TR]
[TD]Rodger, John

[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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
Doe, John7:00A - 3:30P7:00A - 3:30P
Smith, John7:00A - 3:30PDoe, John
Rodger, John7:00A - 3:30PSmith, John
Rodger, John

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

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

[TD="align: center"]2[/TD]

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

[TD="align: center"]3[/TD]

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

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

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

</tbody>
Sheet1

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Array 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] "]E2[/TH]
[TD="align: left"]{=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))}[/TD]
[/TR]
</tbody>[/TABLE]
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself[/TD]
[/TR]
</tbody>[/TABLE]

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)

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][td]
B​
[/td][/tr][tr][td]
1​
[/td][td][/td][td][/td][/tr]
[tr][td]
2​
[/td][td]Doe, John[/td][td]7:00A - 3:30P[/td][/tr]
[tr][td]
3​
[/td][td][/td][td][/td][/tr]
[tr][td]
4​
[/td][td]Smith, John[/td][td]7:00A - 3:30P[/td][/tr]
[tr][td]
5​
[/td][td]Rodger, John[/td][td]7:00A - 3:30P[/td][/tr]
[tr][td]
6​
[/td][td]Del Monte, Linda[/td][td]9:00A - 4:30P[/td][/tr]
[tr][td]
7​
[/td][td]
[/td][td]
[/td][/tr]
[/table]


Sheet2 (processing)

[Table="width:, class:grid"][tr][td]Row\Col[/td][td]
A​
[/td][/tr][tr][td]
1​
[/td][td]7:00A - 3:30P[/td][/tr]
[tr][td]
2​
[/td][td]
3​
[/td][/tr]
[tr][td]
3​
[/td][td][/td][/tr]
[tr][td]
4​
[/td][td]Doe, John[/td][/tr]
[tr][td]
5​
[/td][td]Smith, John[/td][/tr]
[tr][td]
6​
[/td][td]Rodger, John[/td][/tr]
[tr][td]
7​
[/td][td][/td][/tr]
[/table]


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,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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