Excel: Return Column Name for column with largest value - excel

I have 3 columns (W:Y) each with their own name (i.e. Fee Structure, Insurance, Spelling/Grammar)
I want to write a formula that references the name of the column that has the largest value. I tried using MAX with INDEX and MATCH but I have been unsuccessful. This is the formula I attempted:
=index(W1:Y1, match(max(W:Y),W:Y,0))
What do I need to do to fix this formula?

You can add a helper-row that calculates the per-column max value with "MAX" formula (GREEN)
Then, add a second helper row with the column indexes for your data columns (BLUE)
with HLOOKUP, determine the column index of the column with max-value
and finally, unse INDEX to get the value of your header column with the max value
Formulas for green cells (assuming picture showing A:E) are
=MAX(B2:B10)
=MAX(C2:C10)
=MAX(D2:D10)
Blue cells are fixed-values
Calculated value (COL-Index) / consider the "FALSE", because values are not ordered - we need an exact match!
=HLOOKUP(MAX(B11:D11);B11:D12;2;FALSE)
and finally, the resulting INDEX:
=INDEX(B1:D1;1;E13)

Related

min & max value in range in loop

I've faced huge problem with my macro. I have data that contains colums with quantities and values of stock like this:
What I'm trying to achieve is:
to go through every row until the very last, locate quantity (colums with Q letter) and values (colums with V letters) below 0, then adding these quantities below zero to the maximum quantity within the row and adding these values below 0.
to find values within age category for every row that have no corresponding quantity (see cell B4 as example) and add these values to the maximum value within the row.
Why VBA for something you can achieve with a formula?
Let me show you how I calculate the maximum of a list of cells, referring to a column, whose name starts with a "V":
=MAXIFS(A2:F2,A1:F1,"V*")
Screenshot:
Explanation:
Take the maximum of the values on the second row (A2:F2)
The criteria you need to take into account refer to the first row (A1:F1)
The criteria is that it should start with a "V".

Return the heading of the maximum value for more than one Max

I have five columns in Excel and I want to return the maximum value's column heading name. However, there are cases where the max values are repeated more than once for the same row. So, I am trying to return both column names.
The green values are the min and red are the max. In row 4, it is clearly there is more than one Max with same value, I would like to return B and E in the stream cell.
I tried this formula in Excel using the index:
=IF(ISNUMBER(A6),INDEX($B$5:$F$5,1,MATCH(L6,B6:F6,0)),"")
MATCH returns the first match, so I think you need something gross like the following (I started with the first column and row, but you can shift the column numbers -- the rows are designed to be draggable)
=IF(ISNUMBER(F2),IF(F2=A2,$A$1,"")&IF(F2=B2,$B$1,"")&IF(F2=C2,$C$1,"")&IF(F2=D2,$D$1,"")&IF(F2=E2,$E$1,""))
You can use FILTER() to return multiple values. In this example, I've concatenated them with TEXTJOIN():
In cell E2 enter the formula =MAX(A2:D2). In cell F2 enter =TEXTJOIN(,,FILTER(A$1:D$1,A2:D2=E2)). Copy down.

How do you calculate the Quintile for groups of rows in Excel?

I found a partial answer to this question under How do you calculate the Quintile for every row in Excel?. I would like to derive the same quintile data for each row but I need the quintiles to be based on groups that are determined by a value in another column.
Use this formula:
=MAX(1,ROUNDUP(10*PERCENTRANK($C:$C,$C2,4),0))
Change the value 10 to split into whatever number of groups you need - currently it's making decile groups. Change $C:$C to column with target range of values, and change $C2 to the cell in the first row with target value and autofill down.
Your output will be a split of groups based on the value of 1 being lowest and anything greater higher value in terms of numerical value.
If you mean just row numbers as your ranking criteria, you could insert a new column in A and autofill down numbers that correspond to your row references.

Return the max value of a column

I am trying to create a formula for an excel spreadsheet that will search for a specific column header and return the maximum value in that column. I have tried working with hlookup() but I am unsure how I would be able to return the row number of the array associated with the maximum value for multiple columns. Any assistance would be much appreciated.
You can use this formula to get the maximum value in the first column with header "x", assuming 26 columns and 100 rows, adjust as required
=MAX(INDEX(A2:Z100,0,MATCH("x",A1:Z1,0)))
I have data in columns A-C with headers in the first row. I have a cell, D2, which contains a header. The following function gives the max of the column specified by D2:
=MAX(OFFSET(A:A,0, MATCH(D2,A1:C1,0) - 1))

find average for multiple values in rows and columns in Excel

I need a formula to find average for values if column value in 1:1 matches 15 and row value in A:A matches 750 for example,
here is a screen shot for the table
Using simoco's setup you could also use an "array formula" with AVERAGE function, i.e.
=AVERAGE(IF((A3:A17=750)*(C1:M1=15),C3:M17))
confirmed with CTRL+SHIFT+ENTER
Try this one:
=SUMPRODUCT(C3:M17*(A3:A17=750)*(C1:M1=15))/SUMPRODUCT((C3:M17<>"")*(A3:A17=750)*(C1:M1=15))
where
A3:A17 address of values in your column A:A
C1:M1 address of values in row №1
C3:M17 entire target range
First part SUMPRODUCT(C3:M17*(A3:A17=750)*(C1:M1=15)) gives you sum of all values from range C3:M17 where corresponding value in column A equals to 750 and corresponding value in row №1 equals to 15.
Second part SUMPRODUCT((C3:M17<>"")*(A3:A17=750)*(C1:M1=15)) gives you count of all non empty cells in target range C3:M17 where corresponding value in column A equals to 750 and corresponding value in row №1 equals to 15.

Resources