Find max value from multiple columns and return cell value from adjacent column - Excel - excel

I need help finding a way in excel to identify the max value from multiple columns and return the value in the adjacent column.
Using the table below as an example, let's say I want to simultaneously search columns A and C for the max value (89). Once the max value is identified, I would like excel to return the value in the adjacent column and cell (6) to column E. In reality, I need to find the max and adjacent value from eight columns.
A B C D E
1 65 8 36 15 6
2 24 17 89 6
3 11 20 58 13
4 42 5 29 11
I would greatly appreciate your help.
Thanks,

If the max number does not duplicate you can safely use this formula:
=INDEX($A:$D,AGGREGATE(15,6,ROW($A$1:$D$4)/((MOD(COLUMN(A1:D4),2)=1)*($A$1:$D$4=AGGREGATE(14,6,$A$1:$D$4/(MOD(COLUMN(A1:D4),2)=1),1))),1),AGGREGATE(15,6,COLUMN($A$1:$D$4)/((MOD(COLUMN(A1:D4),2)=1)*($A$1:$D$4=AGGREGATE(14,6,$A$1:$D$4/(MOD(COLUMN(A1:D4),2)=1),1))),1)+1)

Related

How to write a multiple criteria index-match that averages all occurrences of results

I am trying to find the average of all occurrences in column C based on an index-match search of column A and B.
Here is the example data:
A B C
1 10 85
1 10 80
2 20 83
2 20 75
Currently, my function is this
=AVERAGE(INDEX(C2:C5,MATCH(1&10,A2:A5&B2:B5,0)))
This produces the value 85. I would like to take the average of both 85 and 80.
Thank you!
Looks like typically a case for AVERAGEIFS(), average a specific column with certain criteria in other columns e.g. your 1 in column A and 10 in column B.
So try:
=AVERAGEIFS(C1:C5,A1:A5,1,B1:B5,10)

Excel: How to not count a particular cell on condition?

I need to calculate a column having many cells but I want to not calculate particular cells on condition. For example:
Scenario:
Sr No Marks
1 46
2 33
3 44
4 32
5 11
6 99
7 27
8 98
I want to get the sum of marks but only those cells should be added whom marks are more than 50. What formula should use?
We can use SUMIF here:
=SUMIF(B2:B9, ">50")
This assumes that your Marks column is in column B, and that the first data point is on the second row.
Edit:
If you want to take the average value of marks, where the mark is over 50, then we can also use COUNTIF:
=SUMIF(B2:B9, ">50") / COUNTIF(B2:B9, ">50")

Match row and column to get the value from the same row - Matrix

I have a matrix like below,
A B C D E F
A 0 12 13 14 15 16
B 12 0 12 15 15 18
C 11 11 0 12 12 15
D 26 24 25 0 22 25
E 87 86 82 12 0 23
F 11 25 36 14 25 0
Now i want that in the below format,
A A 0
A B 12
A C 13
A D 14
A E 15
A F 16
B A 12
B B 0
B C 12 so on.
How can i achive that in excel via formulae.
As stated Offset is a volatile function in that it will always calculate whenever excel calculates regardless if the underlying data has changed or not.
Index is not volatile:
In A10:
=INDEX($A$2:$A$7,INT((ROW(1:1)-1)/ROWS($A$2:$A$7))+1)
In B10:
=INDEX($B$1:$G$1,MOD((ROW(1:1)-1),COLUMNS($B$1:$G$1))+1)
In C10:
=INDEX(A:G,MATCH(A10,$A:$A,0),MATCH(B10,$1:$1,0))
Then copy down
Assuming your data is fixed width (6 here) and exists in columns A-F. Put the following formulas in J1-L1 and fill down. It uses the offset method and looks at fractions of the row, either the remainder or the integer to determine steps for rows (integer) or remainder via mod function (columns).
=OFFSET($A$1,ROUNDDOWN((ROW(J1)-ROW($J$1))/6,0)+1,0)
=OFFSET($A$1,0,MOD((ROW(K1)-ROW($J$1)),6)+1)
=OFFSET($A$1,ROUNDDOWN((ROW(L1)-ROW($J$1))/6,0)+1,MOD((ROW(K1)-ROW($J$1)),6)+1)
I'm hoping I understand your question. But, assuming you had your matrix starting in the top left of the sheet, you would have:
Going Down:
"A" in cell A2, "B" in cell B2, etc
Going Across:
"A" in cell B1, "B" in cell C1, etc
Data:
Your first value (corresponding to A,A) in cell B2
So, now you havem for example, in cell A10 the row letter you want and, in cell A11 the column letter you want. So, you could use the following formula to get your desired result:
=INDEX($B$2:$G$7,MATCH(A10,$A$2:$A$7,0),MATCH(B10,$B$1:$G$1,0))
Basically, using the INDEX() function on your array and matching the row to the desired row letter and the column to your desired column letter.
Hope that makes sense.

Excel Find Value next to max value

If I do a simple formula such as
=MAX(J:J)
and I have a table such as
1 2
2 10
3 45
4 1
5 144
I would expect to see my cell = 144
is there a way for me to get the result 5 (as in the column to the left of the max?)
So if you want the value from column I try this formula
=INDEX(I:I,MATCH(MAX(J:J),J:J,0))
MATCH finds the relevant row number then INDEX gives you the value in column I from that same row

Index & Match formula using IF and ISERROR

I have data in columns C & D. A range of ten students in A1 to A10 are identified with roll numbers. In Column C and corresponding Column D, there are 8 students from roll number 1 to 8 (Column C) and their marks (Column D).
I need a formula in column B to automatically extract the marks from column D against the roll numbers in Column A and the two cells in column B (marks of roll number 9 & 10) may remain blank.
Any Excel formula or VBA macro solution is much appreciated.
Column-A Column-B Column-C Column-D
1 50 1 50
2 55 2 55
3 35 3 35
4 60 4 60
5 78 5 78
6 45 6 45
7 39 7 39
8 82 8 82
9
10
Try using VLOOKUP with IFERROR, i.e. this formula in B2 copied down
=IFERROR(VLOOKUP(A2,C$2:D$9,2,0),"")
VLOOKUP will return the required marks when the roll number exists.....or an error which IFERRORconverts to a blank.
The simplest solution would seem to be copy and paste. Alternative solutions would seem to be relatively simple (eg #barry's) but if you really want INDEX, MATCH, IF and ISERROR then maybe:
=IF(ISERROR(INDEX(D:D,MATCH(A2,C:C,0))),"",INDEX(D:D,MATCH(A2,C:C,0)))

Resources