Index Match with duplicates

ryansm05

Board Regular
Joined
Sep 14, 2016
Messages
148
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a pivot table which lists football teams down column A (home team) and across row 2 (away team).

The values in the pivot table are the game week that the fixtures will be played. From this, I've been able to create an Index Match which summaries the fixtures almost as required. The problem is that in some game weeks, a team may have two fixtures (which is where my limitations of Excel comes in). The below formula has 2 x index match and will stop searching for additional matches once a match has been returned.

I have converted my Excel to a Google Sheet and pasted the link below. The formulas are within C25:I25 and an example of what I'm trying to achieve in F26:F27 can be found in K26:K27.


If anyone has any suggestions I'd be super grateful.

Thanks
Ryan

Excel Formula:
=IFERROR(IFERROR(INDEX($B$2:$U$2,MATCH(C$24,$B3:$U3,0))&" (H)",INDEX($A$3:$A$22,MATCH(C$24,$B$3:$B$22,0))&" (A)"),"")

 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
There are several ways to solve this, so a couple of things before I post an answer as the best method will vary depending on these requirements.

Do you need this to work with google sheets as well, or have you only used that to post the example?

Could you update your profile to show the version of excel that you use (only the oldest one if you use multiple versions), to do this, click your user name at the top right of the page, then go to Account Details, choose a version of excel from those available then scroll to the bottom and save.

Also, (preferable but not essential) there is a link in my signature block to the XL2BB add in which allows you to post small examples straight to the forum.
 
Upvote 0
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe in C25 copied across
Excel Formula:
=TRIM(TEXTJOIN(" (H) ",1,FILTER($B$2:$U$2,$B3:$U3=C$24,"")," ")&TEXTJOIN(" (A) ",1,FILTER($A$3:$A$22,$B$3:$B$22=C$24,"")," "))
 
Upvote 0
Another to filter for the team as well
Fixtures Index_Match fix.xlsx
ABCDEFGHIJKLMNOPQRSTU
1Min of GameweekColumn Labels
2Row LabelsARSAVLBHABURCHECRYEVEFULLEELEILIVMCIMUNNEWSHUSOUTOTWBAWHUWOL
3ARS8381215183332246302521194132835210
4AVL2391338150306254323519270332227
5BHA1624812531203427103732914112163617
6BUR272023791103629372218311636253414
7CHE3616322142734113721726248510301420
8CRY3736524313268161434291017112282021
9EVE143442812302410205082136263221737
10FUL13133519692922122819382515072331
11LEE92619152823222732433133003538125
12LEI2651221933131021243015352819383248
13LIV331221929382527192319336351315711
14MCI5191810351938113138271521024132629
15MUN717303262233714363412252022492816
16NEW342824922714201716365372330123226
17SHU312933382335155311267131827192291
18SOU2021283025326363734171410812241624
19TOT113772622271181714209313342923536
20WBA1714265311292116136202427103183734
21WHU2910151933133582731216111243825193
22WOL221235331371842523282386329151930
23
2416171819202122232425262728293031323334
25ARSvsBHA (A)WBA (A)CRY (H)NEW (H)SOU (A)MUN (H)WOL (A)AVL (A)LEE (H)MCI (H)LEI (A)BUR (A)TOT (H)WHU (A)LIV (H)SHU (A)FUL (H)EVE (H)NEW (A)
26BURvsSHU (H) MUN (H)LIV (A) WHU (A)AVL (H)CHE (A)MCI (H)BHA (H)CRY (A)WBA (H)TOT (A)ARS (H)EVE (A)LEI (H)SOU (A)NEW (H)MUN (A)WOL (A)WHU (H)
27LIVvsNEW (A)SOU (A) BUR (H) MUN (H)TOT (A)WHU (A)BHA (H)MCI (H)LEI (A)EVE (H)SHU (A)FUL (H)WOL (A)CHE (H)ARS (A)AVL (H)LEE (A)NEW (H)MUN (A)
Sheet1
Cell Formulas
RangeFormula
C25:U27C25=TRIM(TEXTJOIN(" (H) ",1,FILTER($B$2:$U$2,FILTER($B$3:$U$22,$A$3:$A$22=$A25)=C$24,"")," ")&TEXTJOIN(" (A) ",1,FILTER($A$3:$A$22,FILTER($B$3:$U$22,$B$2:$U$2=$A25)=C$24,"")," "))
 
Upvote 0
I don't think that the OP has the dynamic array functions, Fluff.
I didn't recognise the user name when I submitted my reply above, but I've already suggested a formula using them in an earlier thread which they were unable to use.
 
Upvote 0
We'll just have to wait & see. It was interesting anyway. :)
 
Upvote 0
I don't think that the OP has the dynamic array functions, Fluff.
I didn't recognise the user name when I submitted my reply above, but I've already suggested a formula using them in an earlier thread which they were unable to use.

Hi Fluff, Jason,

I've updated my details and I do in fact use Office 365 (apol Jason - must have been doing something wrong on the previous thread). Therefore, within Excel, Fluff's* formula works absolutely perfectly. However, as you anticipated, it is not compatible with Google Sheets (GS).

If I did want to replicate this in GS where the dynamic array is not possible - is there a workaround?

Cheers
Ryan
 
Upvote 0
I don't think the filter function in sheets has internal error handling, so it would need to be something like
Excel Formula:
=TRIM(TEXTJOIN(" (H) ",1,ifna(filter($B$2:$U$2,FILTER($B$3:$U$22,$A$3:$A$22=$A25)=C$24),"")," ")&TEXTJOIN(" (A) ",1,ifna(FILTER($A$3:$A$22,FILTER($B$3:$U$22,$B$2:$U$2=$A25)=C$24),"")," "))
 
Upvote 0
Solution
Cell Formulas
RangeFormula
C28:I28C28=IFERROR(IFERROR(INDEX($B$2:$U$2,MATCH(C$24,$B3:$U3,0))&" (H)",INDEX($A$3:$A$22,MATCH(C$24,$B$3:$B$22,0))&" (A)"),"")&IF(COUNTIF($B3:$U3,C$24)=2," "&INDEX($B$2:$U$2,LARGE(INDEX((COLUMN($B3:$U3)-1)*($B3:$U3=C$24),0),1))&" (H)","")&IF(COUNTIF($B$3:$B$22,C$24)=2," "&INDEX($A$3:$A$22,LARGE(INDEX((ROW($A$3:$A$22)-2)*($B$3:$B$22=C$24),0),1))&" (A)","")
C29:I29C29=IFERROR(IFERROR(INDEX($B$2:$U$2,MATCH(C$24,$B4:$U4,0))&" (H)",INDEX($A$3:$A$22,MATCH(C$24,$C$3:$C$22,0))&" (A)"),"")&IF(COUNTIF($B4:$U4,C$24)=2," "&INDEX($B$2:$U$2,LARGE(INDEX((COLUMN($B4:$U4)-1)*($B4:$U4=C$24),0),1))&" (H)","")&IF(COUNTIF($C$3:$C$22,C$24)=2," "&INDEX($A$3:$A$22,LARGE(INDEX((ROW($A$3:$A$22)-2)*($C$3:$C$22=C$24),0),1))&" (A)","")
C30:I30C30=IFERROR(IFERROR(INDEX($B$2:$U$2,MATCH(C$24,$B13:$U13,0))&" (H)",INDEX($A$3:$A$22,MATCH(C$24,$L$3:$L$22,0))&" (A)"),"")&IF(COUNTIF($B13:$U13,C$24)=2," "&INDEX($B$2:$U$2,LARGE(INDEX((COLUMN($B13:$U13)-1)*($B13:$U13=C$24),0),1))&" (H)","")&IF(COUNTIF($L$3:$L$22,C$24)=2," "&INDEX($A$3:$A$22,LARGE(INDEX((ROW($A$3:$A$22)-2)*($L$3:$L$22=C$24),0),1))&" (A)","")
 
Upvote 0
I don't think the filter function in sheets has internal error handling, so it would need to be something like
Excel Formula:
=TRIM(TEXTJOIN(" (H) ",1,ifna(filter($B$2:$U$2,FILTER($B$3:$U$22,$A$3:$A$22=$A25)=C$24),"")," ")&TEXTJOIN(" (A) ",1,ifna(FILTER($A$3:$A$22,FILTER($B$3:$U$22,$B$2:$U$2=$A25)=C$24),"")," "))
That's incredible. It now also works in GS. Thank you much Fluff!

Have an awesome weekend :)

Cheers
Ryan
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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