Cross referencing a table

juca73

New Member
Joined
Dec 30, 2017
Messages
40
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Hi,

I have created a pivot table (PT) with slicers attached and then a rank table using data from the PT.

To find the return ive used a LARGE formula and that works fine,
To find the 1X2 column header i've used a INDEX & SUMPRODUCT with column*column formula
To find the Odds row header i've used the same as above but with the row*row formula

The problem arises when i have identical ( see below ) values the INDEX & SUMPRODUCT formulas do not return the relevant values

Capture2.PNG


Can this be resolved using the formula already in place? or will i need to add a helper table to resolve, bear in mind this data changes when the slicer option is changed

Many Thanks
 

Attachments

  • Capture.PNG
    Capture.PNG
    4.9 KB · Views: 2

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
What version of Excel are you using? You should update your profile to include that information, as it can have a bearing on which solutions might work best for you.

Here is one idea, although I think it can be improved. This uses a helper table in AA7:AE24 that mirrors the size of your pivot table. The helper table holds sequential values...that is its only purpose. The idea is to make the logical comparisons (e.g., does V7:Z24=some value, and then multiply that resulting table of TRUE's and FALSE's by the sequential values in the helper table. If you have the SEQUENCE function (I do not) there may be a way to eliminate the helper table altogether. In any case, this operation results in a matrix whose values are either 0 or some positive integer that identifies the location in the matrix (since we know the number of columns and rows in that matrix). Then the CEILING and MOD functions are used to determine the row and column indexes, and when used in conjunction with the INDEX function, the row and column header details can be identified.

One thing that needs to be clarified...when there are multiple matches, in which order should the matches be reported? For example, in this case, the 5th largest value to find in the data table is 3.80. There are two matches, but since you want only the five largest values, only one of these 3.80 matches will be reported as the 5th data point. Which is it? The formula I've used (AGGREGATE with the 14 option) will return the largest values, and in this case that means the largest values found in the helper array, so values are reported in an order generally corresponding to a direction that starts at the lower right and moves toward the upper left. If you want a different order, then some further adjustments would be necessary.

Here is a snapshot using the XL2BB add-in that looks similar to what you've posted. It may facilitate others offering some improvements.
MrExcel20200708.xlsx
JKLMNOPQRSTUVWXYZAAABACADAE
6LAY HomeLAY DrawLAY AwayLAY U2.5LAY O2.5
71.21-1.3012345
81.41-1.50678910
91.51-1.601112131415
101.61-1.70-1.40-1.301.900.30-0.551617181920
111 X 2OddsReturn1.71-1.80-1.443.80-3.10-2.963.802122232425
12LAY U2.52.26-2.505.311.81-1.90-0.254.75-8.38-0.600.472627282930
13LAY Away2.51-2.754.751.91-2.00-0.81-1.301.05-2.051.663132333435
14LAY Draw2.51-2.754.752.01-2.252.18-2.90-1.13-2.672.093637383940
15LAY Draw1.81-1.904.752.26-2.502.393.35-7.025.31-4.204142434445
16LAY O2.51.71-1.803.802.51-2.75-4.894.754.75-3.041.544647484950
172.76-3.003.531.45-1.422.95-1.815152535455
183.01-3.501.14-1.952.280.60-0.485657585960
193.51-4.001.49-5.552.610.10-0.156162636465
204.01-4.50-0.300.950.950.95-0.346667686970
217172737475
227677787980
238182838485
248687888990
25
Sheet4
Cell Formulas
RangeFormula
AA7:AE24AA7=COLUMNS($V$6:V$6)+(ROWS($U$7:$U7)-1)*COLUMNS($V$6:$Z$6)
J12:J16J12=INDEX($V$6:$Z$6,,MOD(AGGREGATE(14,6,($V$7:$Z$24=$L12)*($AA$7:$AE$24),COUNTIF($L$12:$L12,$L12))-1,COLUMNS($V$6:$Z$6))+1)
K12:K16K12=INDEX($U$7:$U$24,CEILING(AGGREGATE(14,6,($V$7:$Z$24=$L12)*($AA$7:$AE$24),COUNTIF($L$12:$L12,$L12) )/COLUMNS($V$6:$Z$6),1))
L12:L16L12=LARGE($V$7:$Z$24,ROWS(L$12:L12))
 
Upvote 0
KRice

Thank you so much, all of the above is working perfectly. ( using 365 & 2010 )
In answer to the 'when there are multiple matches, in which order should the matches be reported?' question, for this purpose in the rank 5th position it would be the duplicated value that appears first.

Nevertheless, you have saved me from continual headaches over this(y)
 
Upvote 0
You're welcome. I'm not quite sure that I follow your answer...the "duplicated value that appears first" part. If there are duplicate values, do you want them listed in order from upper left to lower right (which is the reverse of what I show)? Since you have 365, you might try replacing the references to the helper table...the *($AA$7:$AE$24) in the formulas with *SEQUENCE(ROWS($U$7:$U$24),COLUMNS($V$6:$Z$6),1,1)
I'm not able to confirm this, but I think that will give the same matrix as the helper table...in which case the helper table would not be necessary. You could try this for one of the results columns J or K, and if it works, do a similar substitution in the other formula.

If that works, then depending on the clarification to the order question, another adjustment might be needed.
 
Upvote 0
I apologize, the order that you have done it is fine. i'll try the alternative formula and let you know if its successful...once again many many thanks
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,936
Members
449,094
Latest member
teemeren

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