Find maximum of row, return column name - excel

I have four rows and six columns of random numbers between 1 and 10. The headers atop are named A through F accordingly. I want to populate a range (A1:A6) on another sheet with the maximum number for each row. That is easy with the MAX function. However, in a another range (B1:B6), I want to put the column name to which this number belongs.
An HLOOKUP() won't work because a maximum value in one row is likely not unique number across the entire sheet. I am thinking a MATCH INDEX type function, but my understanding of those functions, especially in conjunction, is poor.
A B C D E F
1 0 2 10 9 8
9 3 7 6 9 10
10 3 0 2 1 4
9 4 7 8 6 3

Assuming your array is in Sheet1 and the columns are labelled, please try in another sheet, copied down to suit (to Row4 since there are only four rows of numbers in your data):
=INDEX(Sheet1!A$1:F$1,MATCH(MAX(Sheet1!A2:F2),Sheet1!A2:F2,0))
This will return only the first column label from a row where the maximum for that row occurs more than once.

Related

Removing several desired rows from excel sheet using the second sheet

How can I remove specific rows which has the same values in another excel sheet? of course there are many columns but I filter such that specific rows remained in the second sheet and we have those values in first sheet as well as other values. for example below I want to delete rows from second set with the same value in the first column of second set. rest does not matter
A B C
1 2 3
4 5 6
7 8 9
10 1 1
second set
A B C
1 5 6
3 3 9
7 7 6
This checks if the value in A2:A4 is in the other sheet in the A-column:
Formula used (I replaced the ´;´ with ´,´)
ISNUMBER(XLOOKUP(A2,Sheet2!$A:$A,Sheet2!$A:$A,"NOPE"))
The only thing left to do is filter by color and delete the rows. Though do remember that deleting rows in larger quantities, if they're not continuous, can be quite slow.

Sum across columns based on 3 criteria

I'm trying to get a Sumif working across multiple rows.
For example, say my data source is below:
A B C
1 1 10 11
2 2 9 12
3 3 8 13
4 4 7 14
5 5 6 58
I want to sum from Columns A to C, in row 3. Output would be 24.
Ideally my criteria for the Horizontal Start, Horizontal End and Vertical would all be referenced in different cells which can be updated to get a new result depending on the criteria.
Is this possible so that the criteria cells can be updated and the formula will update accordingly?
Use a SUMIF, and betweem the logical criteria, simply use 3 criterias by seperating each with "&"'. This says that excel will sum if a happens, and b and c.

Summing a set of values based on cell content and row position

In the below table rows 2,3 and 4 have some details of a sporting event.
Range A2:C4 has a set of squad numbers and range D2:F4 has the details of who scored goals.
A B C D E F
1 Squad # Scorers
2 1 3 6 2 8 3
3 3 6 7 6 1
4 1 5 6 7 2 4
As an example squad # 6 has scored 8 goals based on the values equivalent position in the Squad section and relative to the Scorers range.
What formula will give me this total value and the equivalent total values for all squad numbers like the table below?
Some cells will be empty like F3.
1 9
3 14
5 2
6 8
7 0
A simple SUMPRODUCT function should take care of this.
=SUMPRODUCT($D$2:$F$4, --($A$2:$C$4=H2))
Fill down as necessary.
        
With only 3 games, the simplest way that I can see to do this would be to use 4 SUMIFS statements, as follows [assumes that your results data is in columns A & B, starting at row 5 and moving down; A5:A12 would hold the IDs for the different squads, and this formula would go in B5 and be copied down]:
=SUMIFS($D$2:$F$2,$A$2:$C$2,A5)+SUMIFS($D$3:$F$3,$A$3:$C$3,A5)+SUMIFS($D$4:$F$4,$A$4:$C$4,A5)
What it does is sum columns D:F, for row 1, row 2, and row 3, based on the fact that columns A:C for those rows match the appropriate squad ID.
This would be possible with an arguably shorter but more complex Array Formula, but with the data as you've presented it, I feel this is the clearest method.

Return list of matching rows

Sheet1
A B C D
1 2 3 4
2 4 5 6
3 3 5 6
4 7 3 1
5 4 6 7
Sheet 2
A B C D
1 4
2 1
3 1 3 4
4 1 2 5
5 2 3
6 2 3 5
7 4 5
Column A of Sheet 2 has a non repeating listing of all values in Sheet 1. I would like a forumla so Col B of Sheet 2 lists the value of Sheet 1 Col A for each row where the Sheet 2 Col A lookup value is found. Either giving me a comma sep list or putting the results in sheet 2 Col B,C,D,...
I came up with a solution, but it involves a handful of formulas, not just one. Hopefully, you will still find it useful.
Your Sheet2 would basically look like this:
Here are the formulas you need to enter:
B1: =IFERROR(SMALL($G4:$U4,COLUMN()-1),"") [drag down and across to D7]
G1: =IF(F2=$W2,F1+1,MAX(1,F1)) [drag across to U1]
G2: =IF(F2=$W2,1,F2+1) [drag across to U2]
G3: =INDEX(Sheet1!B$1:D$5,G1,G2) [drag across to U3]
G4: =IF(G$3=$F4,G$1,"") [drag down and across to U10]
What this does is organize the Sheet1 data into rows, where each row corresponds to a lookup value. Then, it grabs the smallest value, the second smallest value (if one exists), and third smallest value (if one exists) from each row.
This should be easy to scale to as large a spreadsheet as you need (as long as you don't run out of columns).

EXCEL match 2 columns against each other

I have two columns of data, they look something like this:
A B C D
1 2 SOME RECORD
2 6 SOME RECORD
3 10 SOME RECORD
4
5
6
7
8
9
10
So basically column A is a list of indices, where some of them appear in column C with corresponding records saved in column D. Column B is currently empty, and what I want to do is if say index 2 appears in both column A and column C (they matches), then put the record beside C2 in the cell B2. So essentially I want it to look like this:
A B C D
1 2 SOME RECORD
2 SOME RECORD 6 SOME RECORD
3 10 SOME RECORD
4
5
6 SOME RECORD
7
8
9
10 SOME RECORD
Can someone help please?!! Thanks!!!
UPDATE: I tried this and it doesn't work. The data in column D is calculated using a UDF and is refreshing every 1 second. The VLOOKUP function fails even though I can see the 2 indices are the same!! Is it because of the format of the cell or column? I.e. does vlookup compare data type as well?
Assuming your data in A starts from A1 - put in B1 the following and autofill:
=IFERROR(VLOOKUP($A1,$C:$D,2,0),"")
This includes handling of missing values.
You'll want this:
B1=VLOOKUP(A1, C:D, 2, FALSE)
This will look up the value in column A within the array spanning columns C and D. It will give you the value found in the second column (D). FALSE makes it an exact match, otherwise you might get 2 and 20 matching because hey, they're kind of similar...

Resources