How to Index column header from defined data in table, Large to small

Copper Contributor

Hi,

I have a table that has multiple columns listing store names, and multiple rows listing Product names, and the sales data in the table for models sold by each store. I have created a formula successfully to list out the highest to lowest sales for a defined model, but I am having trouble indexing the store to which each listed Qty was sold by.

My formula to find High to low QTY:

={IFERROR(IF(MATCH($P$1,$A:$A,0),LARGE(INDEX($A$1:$N$15,MATCH($P$1,$A:$A,0),$B$2:$N$15),ROW(1:1))),"")}

I have tried multiple formula's to list the corresponding store to the returned Qty Value (bearing in mind the sequence of stores returning the same value, and not just indexing the same store name for multiple same Qty's).

File is attached.

Any help is hugely appreciated. 

5 Replies

@dougs5220 

assuming that you have latest version of office , you can check following formula 

 

=INDEX(SORT(TRANSPOSE(FILTER(B1:N15,(A1:A15=P1)+(A1:A15="PRODUCT"))),2,-1),,1)

 

the formula is applied in attached file 

@Kodipady 

unfortunately not 365. using 2016, which doesn't have Sort Function.

any alternative thought?

 

@dougs5220 

For such result

image.png

it could be

in S3

=LARGE(INDEX($B$2:$N$15,MATCH($P$1,$A$2:$A$15,0),0),ROW()-ROW($S$2))

in T3

=INDEX($1:$1,
  AGGREGATE(15,6,
    1/(INDEX($B$2:$N$15,MATCH($P$1,$A$2:$A$15,0),0)=$S3)*COLUMN($B$1:$N$1),
    COUNTIFS($S$3:$S3,$S3)
  )
)

and drag them down

@Sergei Baklan 

Thank you greatly, Sergei.

You are a Legend.