calculating max value ocurrance for each row formula in excel - excel

A B
1 4
2 5
3 6
100 7
1000 8
how can find number of max value of column values for each row.
=COUNTIF(A1:B5,A1:A5) trying this but this gives 0. I expected 2.
Since; 100 and 1000 are the max values of their rows. need only max value times for rows for A

This is one of the ways you can do it.
Should give you 2.

Related

Finding maximum value in group

I want to create a column of data that finds the largest value in column BD, based on individual values in Column B. I would have thought this equation would work! Anyone have any recommendations??
(first attempt)
=IF(BD3=0,0,SUMIFS($BD$3:$BD3,$B$3:$B3,B3,$BD$3:$BD3,MAX($BD$3:$BD3)))
(Second attempt)
=IF(BD3=MAXIFS($BD$3:$BD3,$B$3:$B3,B3),MAXIFS($BD$3:$BD3,$B$3:$B3,B3),0)
Projectid(B)
cumulative production(BD)
result I want()
1
20
0
1
60
0
1
70
70
2
0
0
2
0
0
3
20
20
4
0
0
5
0
0
6
0
0
7
10
0
7
40
0
7
60
60
this code should work:
=IF(MAXIFS($BD$1:$BD$12,$B$1:$B$12,A1)=BD1,MAXIFS($BD$1:$BD$12,$B$1:$B$12,B1),0)
If you have access to LAMBDA() function then can use below formula at one go.
=LET(a,BYROW(A2:A13,LAMBDA(x,MAXIFS(B2:B13,A2:A13,x))),IF(B2:B13=a,a,0))
Similar to SUMIFS you find MAXIFS
https://support.microsoft.com/en-us/office/maxifs-function-dfd611e6-da2c-488a-919b-9b6376b28883
Then just compare the MAX with the actual row value.
Edit based on your reply:
One way is to start with one operation in the cell first then it is easier to follow.
Your MAXIF should be like this (looking for the max in column B of those rows having the same value in column A as the value of current column A)
=MAXIFS(B$2:B$13;A$2:A$13;A2)
Then compare to B2
So, basically you got it, need just to adjust your second part of the MAXIFS :-)

How to find if a number in a row matches a number in a column, and then automatically offset the number in the column to another value

How to find if a number in a row matches a number in a column, and then automatically offset the number in the column to another value. For example:
Row 0 1 2 3 4 5
Answer x x x x x x
Column
0 100
1 340
2 500
3 266
4 455
5 800
So if "0" in the Row array matches "0" in the Column array, then show 340 and so on. I can to this with nested IF statements but is there an easier way if you have 100s of columns. Thanks

Issue with formula including LARGE() + multiple criterias

At the moment my formula looks for a LARGE number in column D, which is greater than number in K4, however if the number in K4 is greater than the LARGEST number in col D I get an error #NUM!
=IF(AND($K$4="",$D$5=""),"Not Reported",IF(AND($K$4="",$D$5<>""),"Missing DATA",IF(AND($K$4<>"",$D$5<>""),INDEX($E$5:$E$23,MATCH((SMALL($D$5:$D$23,COUNTIF($D$5:$D$23,""&$K$4)+1)),$D$5:$D$23,0),1))*1-$K$4/SUM(LARGE($D$5:$D$23,COUNTIF($D$5:$D$23,">"&$K$4)+1)+SMALL($D$5:$D$23,COUNTIF($D$5:$D$23,""&$K$4)+1))))+INDEX($E$5:$E$23,MATCH("P98",$A$5:$A$23,0)))))
Can you advise how to alter it, so if the above occurs, instead of taking the number from K4 into consideration, simply replace it with whatever the LARGEST number in col D is and finish the rest of calculations [embedded in the formula]. Appreciate your help.
PS. IFERROR is not an option (it doesn't solve this)
SAMPLE DATA [where the error occurs]:
VALUE OF $K$4
250000
COLUMN A
PERCENTILE
P10
P20
P30
P40
P50
P60
P70
P80
P90
P91
P92
P93
P94
P95
P96
P97
P98
P99
P100
COLUMN D
NUMBER
3500
4096.79
10000
13500
15000
18299.46
25000
39000
50000
50000
50000
50000
200000
200000
200000
200000
200000
200000
200000
COLUMN E
VOLUME
2
2
1
2
1
2
2
1
2
0
0
0
1
0
0
0
0
0
0
I can't give an exact answer since I don't have exact detail about what you're trying to do, however it sounds like you want to do something like this:
=max(k4, d:d)
So: If K4 is the same are bigger than the largest number in Column D, then use K4. Otherwise, use the biggest number in Column D.
More Information:
Office.com : MAX Function
MAX vs MAXA vs LARGE and MIN vs MINA vs SMALL Functions in Excel
So, this works for me:
=IF($J$4="",F27,(IF(J4>=MAX(B5:B23),(INDEX($C$5:$C$23,MATCH((SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,"<"&IF(J4>MAX(B5:B23),MAX(B5:B23),J4))+1)),$B$5:$B$23,0),1))*(1-((IF(J4>MAX(B5:B23),MAX(B5:B23),J4))/SUM(LARGE($B$5:$B$23,COUNTIF($B$5:$B$23,">"&(IF(J4>MAX(B5:B23),MAX(B5:B23),J4)))+1)+SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,"<"&(IF(J4>MAX(B5:B23),MAX(B5:B23),J4)))+1))))+INDEX($C$5:$C$23,MATCH("P98",$A$5:$A$23,0),1),IF(J4<=MIN(B5:B23),INDEX($C$5:$C$23,MATCH((SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,">"&IF(J4<MIN(B5:B23),MIN(B5:B23),J4))+1)),$B$5:$B$23,0),1))*(1-((IF(J4<MIN(B5:B23),MIN(B5:B23),J4))/SUM(LARGE($B$5:$B$23,COUNTIF($B$5:$B$23,"<"&(IF(J4<MIN(B5:B23),MIN(B5:B23),J4)))+1)+SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,">"&(IF(J4<MIN(B5:B23),MIN(B5:B23),J4)))+1))))+INDEX($C$5:$C$23,MATCH("P98",$A$5:$A$23,0),1),(INDEX($C$5:$C$23,MATCH((SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,"<"&$J$4)+1)),$B$5:$B$23,0),1))*(1-($J$4/SUM(LARGE($B$5:$B$23,COUNTIF($B$5:$B$23,">"&$J$4)+1)+SMALL($B$5:$B$23,COUNTIF($B$5:$B$23,"<"&$J$4)+1))))+INDEX($C$5:$C$23,MATCH("P98",$A$5:$A$23,0),1)))))
I had to also hedge against the K4 (or J4) value being <MIN(B5:B23)

Microsoft Excel Finding Position Based on two column data?

Fail Count Total Number Position
0 666 3
1 555 5
0 777 1
2 444 7
1 888 4
2 655 6
3 566 9
3 780 8
0 700 2
Position column is result that I need automatically by function (any combination of builtin function or custom function). Logic here is the minimum value of column (Fail count) and maximum value of column (Total Number) will first position. And minimum value of column (Fail count) and second maximum value of column (Total Number) will second position. It will continue till end data of column A and B.
How about simply sorting you data: Order by Fail Count ascending and, if equal Fail Count, by Total Number descending?
With a formula this becomes an array formula with very bad performance.
Formula in D2downwards:
{=MATCH(B2*10^(MAX($A$2:$A$1000)-A2),LARGE($B$2:$B$1000*10^(MAX($A$2:$A$1000)-$A$2:$A$1000),ROW($A$2:$A$1000)-ROW($A$1)),0)}
This is an array formula. Input it into the cell without the curly brackets and press [Ctrl]+[Shift]+[Enter] to finish.

Is there any range or between kind of function in Excel?

I have a table with three columns in Excel, a,b and c.
One cell has a numeric value X [say 25], I need to get the value in the c column such that X should be in between min and max column. For X=25 the value in c is "20" since X is between the min and max values for the 5th table row.
I'm looking for a range or between kind of function, but couldn't find a function with either name.
a b c
-----------------------------
min max improvements
0 1 70
2 5 60
6 10 50
11 20 30
21 30 20
31 40 10
41 80 5
You want to look up in that table of yours which improvement value is correct if some value is "25"; in this case that would mean to match line 5 of your table and return the value 20.
You are looking for VLOOKUP, e.g.
=VLOOKUP(B12;A2:C8;2)
giving
(edit: fixed stupid typo in formula and image, now giving correct result)

Resources