Index/Match error in formula

BradleyS

Active Member
Joined
Oct 28, 2006
Messages
351
Office Version
  1. 2010
Platform
  1. Windows
I have the following formula's which sort of work fine (shown below) to transpose the data in the first table below, except if the ID value (in column A) is the same value as the result (in column C)

So if C2 was changed to 8, it would ignore it and then mess up all the other figures for that ID row

I can't seem to work out how to resolve this, but still maintain the final result. Help would be very appreciated

This is my data table:

Excel 2010
ABC
1IDdateresult
2828/11/20185
3828/08/20184
4828/05/20187
52516/12/20136.15
62513/06/20136
72501/02/20135.65
84015/08/20120.56
96909/06/20162
106903/04/20133.34
117628/03/20110.81
1218704/12/20133.39
1318722/07/20112.86
1421119/08/20132.92
1521119/04/20132.9
1621928/07/20115.88
PSA


This is the output including the formulas:

Excel 2010
EFGHIJKLMNO
1IDdateresult 1dateresult 2dateresult 3dateresult 4dateresult 5
2828/11/2018528/08/2018428/05/20187    
32516/12/20136.1513/06/2013601/02/20135.65
44015/08/20120.56
56909/06/2016203/04/20133.34
67628/03/20110.81
718704/12/20133.3922/07/20112.86
821119/08/20132.9219/04/20132.9
921928/07/20115.88
PSA
Cell Formulas
RangeFormula
E2{=INDEX($A$2:$A$16, MATCH(0, COUNTIF($E$1:$E1, $A$2:$A$16), 0))}
F2{=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($E2:E2,$B$2:$B$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
G2{=IFERROR(INDEX($C$2:$C$16, MATCH(0, COUNTIF($E2:F2,$C$2:$C$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
H2{=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($E2:G2,$B$2:$B$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
I2{=IFERROR(INDEX($C$2:$C$16, MATCH(0, COUNTIF($E2:H2,$C$2:$C$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
J2{=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($E2:I2,$B$2:$B$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
K2{=IFERROR(INDEX($C$2:$C$16, MATCH(0, COUNTIF($E2:J2,$C$2:$C$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
L2{=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($E2:K2,$B$2:$B$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
M2{=IFERROR(INDEX($C$2:$C$16, MATCH(0, COUNTIF($E2:L2,$C$2:$C$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
N2{=IFERROR(INDEX($B$2:$B$16, MATCH(0, COUNTIF($E2:M2,$B$2:$B$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
O2{=IFERROR(INDEX($C$2:$C$16, MATCH(0, COUNTIF($E2:N2,$C$2:$C$16)+IF($A$2:$A$16<>$E2, 1, 0), 0)), "")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi Bradley,

I had to use a helper row F2-O2 as I don't think you can split array formulas for different columns of data.

Note that you will need to repeat the process across columns for how many results you will encounter.


Book1
ABCEFGHIJKLMNO
1IDdateresultIDdateresult 1dateresult 2dateresult 3dateresult 4dateresult 5
2828-11-1851122334455
3828-08-184828-11-18528-08-18428-05-187    
4828-05-1872516-12-136.1513-06-13601-02-135.65
52516-12-136.154015-08-120.56
62513-06-1366909-06-16203-04-133.34
72501-02-135.657628-03-110.81
84015-08-120.5618704-12-133.3922-07-112.86
96909-06-16221119-08-132.9219-04-132.9
106903-04-133.3421928-07-115.88
117628-03-110.81
1218704-12-133.39
1318722-07-112.86
1421119-08-132.92
1521119-04-132.9
1621928-07-115.88
Sheet1
Cell Formulas
RangeFormula
F2=COUNTIF($F$1:F1,"Date")
F3{=IF(F$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),F$2)),""))}
E3{=IFNA(INDEX($A$2:$A$16, MATCH(0, COUNTIF($E$1:$E1, $A$2:$A$16), 0)),"")}
G3{=IF(G$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($C$2:$C$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),G$2)),""))}
H3{=IF(H$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),H$2)),""))}
I3{=IF(I$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($C$2:$C$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),I$2)),""))}
J3{=IF(J$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),J$2)),""))}
K3{=IF(K$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($C$2:$C$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),K$2)),""))}
L3{=IF(L$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),L$2)),""))}
M3{=IF(M$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),M$2)),""))}
N3{=IF(N$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),N$2)),""))}
O3{=IF(O$2>COUNTIF($A$2:$A$16,$E3),"",IF(ISNUMBER($E3),INDEX($B$2:$B$16,SMALL(IF($A$2:$A$16=$E3,ROW($A$2:$A$16)-ROW($A$2)+1),O$2)),""))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,185
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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