Excel MATCH to sum of two cell values - excel

I have a table of data that include a name column and two numeric columns. Example:
A B C
Fred 4 2
Sam 3 6
George 1 7
I'm wanting to retrieve the name in column A for the largest sum of columns B and C. In the example above, I would want "Sam" because 3+6 is greater than any of the other sums.
I know I could create a hidden column (D) that's filed with
=SUM(B2,C2)
and do something like this:
=INDEX(A:A,MATCH(MAX(D:D),D:D,0))
but I'd rather avoid the hidden column, if possible. Is there a way to perform an index-match based on the sum of two cells?

Use the array formula:
=INDEX(A:A,MATCH(MAX((B:B)+(C:C)),(B:B)+(C:C),0))
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.
(Note the appearance of braces in the formula bar)

Related

Number occurrences in another cell (Excell) [duplicate]

I have simple problem, but I've not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It's best explained in this picture
I require a method to calculate column B.
I'd be very grateful for any help.
Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?
If the latter, then the formula to write in cell B2 is:
=COUNTIF(A$2:A2,A2)
then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)
If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.
You can use the COUNTIF worksheet function, with a relative address.
Eg. In cell B2, enter this formula:
=COUNTIF(A$2:A2,A2)
And then fill-down.
Use the following formula to generate the required series:
=COUNTIF($A$1:A1,A1) and strech(copy) it in all the cells
This will generate result like this:
A 1 COUNTIF($A$1:A1,A1)
A 2 COUNTIF($A$1:A2,A2)
C 1 COUNTIF($A$1:A3,A3)
C 2 COUNTIF($A$1:A4,A4)
B 1 COUNTIF($A$1:A5,A5)
B 2 COUNTIF($A$1:A6,A6)
A 3 COUNTIF($A$1:A7,A7)
C 3 COUNTIF($A$1:A8,A8)
D 1 COUNTIF($A$1:A9,A9)
D 2 COUNTIF($A$1:A10,A10)
D 3 COUNTIF($A$1:A11,A11)
D 4 COUNTIF($A$1:A12,A12)

Formula to Return Text in the Row of Largest Number

Column A Has Text & Columns B, C & D contain numbers.
For Ex.)
A... …B C D
John 4 6 2
Dave 4 6 4
Mike 4 5 1
Bill 2 5 9
I would like a cell to return the name in column A that has the Largest Number in Column B. And if there are similar numbers, go to the next column and determine which is highest, and if that is tied go to the next column and so on.
Any help would be appreciated.
We can de-conflict ties.In E1 enter:
=B1 + C1/(10*MAX(C:C))+D1/(100*MAX(D:D))
and copy down. Then in another cell enter:
=INDEX(A:A,MATCH(MAX(E:E),E:E,0))
EDIT#1
This is only good for 3 columns of numbers, but it is very easy to add additional de-confliction terms if necessary:
=B1 + C1/(10*MAX(C:C))+D1/(100*MAX(D:D))+E1/(1000*MAX(E:E))
For an expandable number of rows/columns, use a helper row with the same number of columns as number columns in your data. The formulas below reference the following image (the data are in A1:G7):
B9-->=MAX(B1:B7)
C9 (fill over the remaining columns to G9)-->
=MAX(IF(MMULT(--($B1:B7=$B9:B9),--(ROW(INDIRECT("1:"&COLUMNS($B9:B9)))>0))=COLUMNS($B9:B9),C1:C7))
The following formula will give the answer (shown in A9 above):
=INDEX(A1:A7,MATCH(TRUE,(MMULT(--($B1:G7=$B9:G9),--(ROW(INDIRECT("1:"&COLUMNS($B9:G9)))>0))=COLUMNS($B9:G9)),0))
UPDATE WITH ALTERNATIVE METHOD
Using a helper column instead, again referencing the image below (the data are in A1:G7):
I1 (fill down to I7)-->
=SUM(--(MMULT(SIGN(B1:G1-$B$1:$G$7)*2^(COLUMN(G1)-COLUMN(A1:F1)),--(ROW(INDIRECT("1:"&COLUMNS(B1:G1)))>0))>0))
The following formula will give the answer (shown in J1 above):
=INDEX(A1:A7,MATCH(MAX(I1:I7),I1:I7,))
As a bonus, notice that the helper column corresponds to the order that you would get from sorting the data by each column left-to-right. In other words, you could use the helper column to perform a formula-based multi-column sort on strictly numeric data. For the last image, entering the following array formula into a range with the same dimensions as A1:G7 gives a descending sort on columns B through G:
=IF(A1:A7=A1:A7,INDEX(A1:G7,MATCH(ROW(A7)-ROW(A1:A7),I1:I7,0),))

Formula to sum items in a column only if other column has specific value

I have an excel table with 2 columns. First column contains a string such as A,B,C and second column contains numbers. I want to obtain sum of numbers in each row if text of first column for that row is equal to given text.
For example:
A 2
C 3
B 4
A 1
C 3
formula(A) = 3
formula(B) = 4
formula(C) = 6
and so on.
One way to achieve this is via SubTotal option. Follow the example in this link Creating subtotals
Another way to do the same is using sumif function follow this link Sumif function
SUMIFS() is capable of doing this. As is SUMPRODUCT()
In european excel this would look like this. I don't know where your reference is so I am putting it in a cell named Reference.
SUMIFS($B:$B;$A:$A;"="Reference)
If you want a "running" count, then replace the arrays - from $B:$B to B$2:B2 and similar with $A:$A, and copy it down the rows.

Excel - list entities (items)

Friends,
I need to list all the unique entities (items) in a Excel spreadsheet, how to?
E.g.
**List1**
1
1
1.1
2
a
a
aa
b
c
c
And I need a certain function that returns:
**Entities**
1
1.1
2
a
aa
b
c
Then I can count the occurence of each entity (using COUNTIF function).
With data in column A, in B2 enter the array formula:
=IFERROR(INDEX($A$2:$A$11,MATCH(0,COUNTIF($B$1:B1,$A$2:$A$11),0)),"")
In C2 enter:
=COUNTIF($A$2:$A$11,B2)
and copy down.
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key.
You can also apply pivot to your list to identify uniqueness. One you have identified the unique list, you can apply count if formula.

Excel line up data

I'm a total Excel nub and can't find the answer I'm looking for. Must be easy peasy, but since I'm not into Excel I also don't know what to look for. Sorry if I'm having my question wrong.
I have output in Excel like this:
A 1
A 2
A 3
A 4
B 1
B 2
B 3
B 4
B 5
B 6
and I want it like this:
A 1 2 3 4
B 1 2 3 4 5 6
this question is quite complex in a way.
let me explain it more in detail:
as you see above, we have two columns A and B, you have text strings in column A , these text strings could be repeated. As you see in the example, there are 4 As, 5 Bs, 3 Cs 1 D and 3 Es. In column B each one of these strings have different corresponding values. For example, text strings B in column A has five corresponding values in column B, namely 11, 12, 13, 14, 15, and 16.
Now we want a list of UNIQUE values from column A, and lets say, we put this list in column C and then for each of these unique values in column C we want to list their corresponding cells in column B and put them HORIZONTALLY in front of each of these unique text strings in column C.
For this you need two kinds of formulas:
Formula 1 to calculate the list of the unique values in column A :
this goes in C2:(leave C1 empty)
=IFERROR(INDEX($A$1:$A$999;MATCH(0;FREQUENCY(IF(EXACT($A$1:$A$999;TRANSPOSE($C$1:C1));MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999)); ""); MATCH(ROW($A$1:$A$999);ROW($A$1:$A$999))); 0)); "")
this is an array formula, so press ctrl+shift+enter to calculate the formula, and drag and fill down as many as you want in column C.
*Formula 2 to find and list horizontally the values from column B *
=IFERROR(INDEX($B$1:$B$999;SMALL(IF($C2=$A$1:$A$999;ROW($A$1:$A$999)-ROW($A$1)+1);COLUMN(A$1)));"")
this is an array formula, so press ctrl+shift+enter to calculate the formula, put this in D2 and drag and fill down until the last cell of column C. then select D2 to D6 and drag and fill horizontally. You should get all of the corresponding cells in front of each unique item.
P.S. adjust the formulas to meet your regional settings by replacing ; with , I suppose.
Finally here is the link to an example sheet downloadable from here .
This is very generic but hopefully will help.
Highlight the cells that you want to transpose to.
Type the equation..."=TRANSPOSE(B1:B4)" (edit as necessary).
While the cells are still highlighted, press "ctrl+shift+enter". (brackets should appear around the equation)
Finish editing the cells.
Celebrate

Resources