Find Cell Address - excel

ColumnA Column B Column C
name sales index
A 1250 1875
B 5500 15000
C 4500 5625
F 12750 13125
B 7250 28125
F 2000 13875
E 9250 23625
F 39250 16875
A 2250 25500
B 7250 15750
A 8250 29250
B 16500 11625
C 500 804000
In the above table I want to find out the cell address when F has maximum sales. Can somebody help me with excel formula. e.g. in the above table the output will be B9

Try:
="B" & MATCH(MAX(IF(A:A="F",B:B)),IF(A:A="F",B:B),0)
This is an array formula and must be confirmed with Ctrl-Shift-Enter. This will return the address of the first max value for "F" if there are equal values that are the max.
Also as noted by #XORLX Change the whole column references to the actual data size or big enough to cover what is needed. This will speed up the calculation. With the Array formula it will iterate through the whole column twice. It will run over 2 million times.
Though the real question is for what purpose are you going to use the answer? If the end is to merely know the address then use the above.
But if not then there may be a way to get to the end in one step.

Related

Find The Highest Value And Return Adjacent Cell Value with duplicates In Excel

I am having an excel with below table
A B
Name Score
A 80
B 45
C 34
D 45
E 99
F 99
G 99
In the above table E, F and G's scores are same (sharing the maximum value).
I am trying to achieve the Top 3 'Names' and hence trying the formula -
Max 2nd =INDEX(A1:A8,MATCH(LARGE(B1:B8,2),B1:B8,1))
Max 3rd =INDEX(A1:A8,MATCH(LARGE(B1:B8,3),B1:B8,1))
However, I am getting the FIRST name's 'E' only for the rest of the maximum. values.
I am expecting F and G to be displayed the next.
Can anyone please help.
Thanks in advance
You will need a list of the scores that you can increase the LARGE's k parameter using COUNTIF. This can be something as simple as the following in an unused cell and filled down,
=large(b$2:b$8, row(1:1))
Now use this formula beside the list you just created and fill down.
=INDEX(A:A, AGGREGATE(15, 7, ROW(A:A)/(B$1:B$8=E2), COUNTIF(E$2:E2, E2)))

Assign one value at the time from a column i Excel if the value is the same

I got some help with a problem finding column values in Excel: Find column value Excel
The table looks like this:
A 17 8,5 5,666666667 4,25 3,4 2,833333333 2,428571429
B 5 2,5 1,666666667 1,25 1 0,833333333 0,714285714
C 5 2,5 1,666666667 1,25 1 0,833333333 0,714285714
G 4 2 1,333333333 1 0,8 0,666666667 0,571428571
The code that I got help with basically selects A, B, C and G based of the order of the largest numeric value. The largest value is 17, that is one point for A, then comes 8,5 which gives another point for A. That works fine.
However, then comes 5. I now get B two times instead of first B and the C (the order does not matter, but I do not want to get two points for B when B and C have the same value). How can this be fixed?
(The real problem that this example illustrates is the number of seats on local boards in Swedish multiplicitets, where the number of seats for the different parties is based on the number of seats in the city council.)
Edit: Formula: =INDEX($J$16:$J$25,AGGREGATE(14,6,ROW($K$16:$W$25)/(K28=$K$16:$W$25),1)-ROW($J$16)+1)
Edit2: Wanted result:
Mandate Party
1 A
2 A
3 A
4 B
5 C
To do this by formulas, I think a simple way is to
unpivot the original data using formulas
Apply a unique rank formula to that data
Then use VLOOKUP to return ranks 1-n
The following formulas and defined names will be useful
origTbl =Sheet2!$A$1:$H$4
unpivotTbl =Sheet2!$A$8:$C$35
A8 =RANK(C8,$C$8:$C$35,0)+COUNTIF($C$8:C8,C8)-1
B8 =INDEX(origTbl,INT((ROWS($1:1)-1)/7)+1,1)
C8 =INDEX(origTbl,INT((ROWS($1:1)-1)/7)+1,MOD(7+ROWS($1:1)-1,7)+2)
Fill down A8:C8 to row 35
In the formulas in B8 and C8, the 7 is the number of columns in origTbl minus 1 (eg: COLUMNS(origTbl)-1)
Any changes you make in origTbl will be reflected in the final table
For appearances, you can certainly hide the UnPivot table someplace.
Note: in my locale, decimal separator is the dot

Excel Using SUMIF to sum and select higher numbers

I have the range of figures below
D E
3000 6500
20000 0
15000 0
16000 20000
22000 0
I would like to take the total of column D but add the figures from column E to replace the corresponding value in column D if it exists. For example 3000 would be replaced by 6500 in the top line and 20000 would supersede 16000 in row 4.
I have been taking the sum of column d and manually subtracting D1 and adding E1 and D4 for E4 however as column E may be populated over time I would like not to have to do this over and over again.
Any help on this much appreciated.
An array formula should handle this nicely.
      
The array formula in D2 is,
=SUM(IF(A1:A5>B1:B5, A1:A5, B1:B5))
Array formulas need to be finalized with Ctrl+Shift+Enter↵.
Without array option:
=SUM(E:E)+SUMIF(E:E,0,D:D)
For higher numbers, you might add a column with a formula such as:
=MAX(D2,E2)
and sum that column.

Issues with VLOOKUP in Excel

I have a tax table in one sheet that has a list of tax values. For example:
Sheet1: Tax Tables
A B C
1 Min Max Taxed
-------------------
2 50 100 10
3 100 200 20
4 200 300 30
In another sheet I have a gross income value of say 120 in cell A1. What I want to do is have a vlookup (I'm assuming that's what I should use) that checks cell A1 to see if it's between the Min and Max and then outputs the taxed amount in B1.
Sheet2: Income
A B
1 Gross FedTax
-----------
2 120 Value from Column C goes here
I already have the sheet in Tax Tables set up with named spaces A:C=Min and B:C=Max
I tried doing this:
=AND(VLOOKUP(<A1,Min,3,False),VLOOKUP(>A1,Max,2,FALSE))
But not even close...
I just want to check column A in the first sheet to see if it's less than the the value in the second sheet, and check column B in the first sheet against the value in the second for if its more, then put the value in column C in the first sheet into the cell next to the value in the second sheet.
To use a VLOOKUP, put your maximums and minimums in the same column.
Then use the TRUE argument, which means it looks for the next value that matches. Assuming the value you're looking up in D2, you'd put a formula like this in E2:
=VLOOKUP(D2,$A$2:$B$5,2,TRUE)
First of all it is unclear what you would apply when the amount is exactly 50/100/200/300/... So i decided to include the lower limit in the interval and exclude the upper limit.
For this problem I would use a sumifs like this (you have to decide on which side to put the equal sign:
=SUMIFS(Sheet1!C:C;Sheet1!A:A;"<="&A1;Sheet1!B:B;">"&A1)
This would only take those elements in column C that have a value in column A smaller than or equal to 120 and a value in column B greater than 120

Find what cell another cell is referencing

I want to know what column a cell is referring to. Based on the cell it refers to, a different formula will apply.
example:
A B C D E F G
HIGH LOW Choice Gaude
Terry 20 50 50 LOW
Tom 40 1212 1212 LOW
James 101010 121 101010 HIGH
Serra 5 5 HIGH
Sam 50 50 50 LOW
cell E formula
=c2
=c3
=b4
=b5
=b6
cell G formula
=IF(F8=D8,"LOW","HIGH")
The problem is that Sam is meant to be High.
I hope my example helps you understand my predicament.
Are you manually entering the formula in the Choice column E? Maybe it's better to make the Gaude column drive the Choice column instead:
Cell E formula
= If(Exact(G2, "HIGH"), B2, C2)
And instead of changing the referenced column in E, just change G cells to LOW or HIGH as you require.
If I read your quextion correctly, you want a formula that can analyse the formuala contained in another cell, and tell what column it refers to.
You will need a UDF for thism such as
Function WhatColumn(r1 As Range) As Variant
WhatColumn = Range(r1.Formula).Column
End Function
This will return a column number (2 for column B)
You would use this like
=IF(E8=2,"HIGH","LOW")
so if cell E8 contains =B8 WhatColumn will return 2

Resources