Max, Frequency, If, Countifs......and somewhere in between

Nintapper

New Member
Joined
Dec 26, 2017
Messages
7
Hi there,
Tried and tried but can´t get what I need.
My data in A looks something like this:
0.2
0.0
-0.7
3.6
-0.2
8.6
0.3
0.0
-1.1
5.0
-5.1
-3.2
11.1
18.1
-2.70
And the "bin ranges" look like this:
-3.00+
-2.90 to -2.00
-1.90 to -1.00
-0.90 to 0.90
1.00 to 1.90
2.00 to 2.90
3.00+

And I need to calculate the highest consecutive number for each "bin range". So the results should look like this:
-3.00+ =2
-2.90 to -2.00 =1
-1.90 to -1.00 =1
-0.90 to 0.90 =3
1.00 to 1.90 =0
2.00 to 2.90 =0
3.00+ =2

Many thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Welcome to Mr Excel forum

Maybe something like this

[Table="class: grid"][tr][td="bgcolor: #DCE6F1"][/td][td="bgcolor: #DCE6F1"]
A
[/td][td="bgcolor: #DCE6F1"]
B
[/td][td="bgcolor: #DCE6F1"]
C
[/td][td="bgcolor: #DCE6F1"]
D
[/td][td="bgcolor: #DCE6F1"]
E
[/td][/tr]
[tr][td="bgcolor: #DCE6F1"]
1
[/td][td]
Numbers​
[/td][td][/td][td]
Lower​
[/td][td]
Higher​
[/td][td]
MaxConsec​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
2
[/td][td]
0,2​
[/td][td][/td][td]
-1000000​
[/td][td]
-3​
[/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
3
[/td][td]
0,0​
[/td][td][/td][td]
-2,9​
[/td][td]
-2​
[/td][td]
1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
4
[/td][td]
-0,7​
[/td][td][/td][td]
-1,9​
[/td][td]
-1​
[/td][td]
1​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
5
[/td][td]
3,6​
[/td][td][/td][td]
-0,9​
[/td][td]
0,9​
[/td][td]
3​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
6
[/td][td]
-0,2​
[/td][td][/td][td]
1​
[/td][td]
1,9​
[/td][td]
0​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
7
[/td][td]
8,6​
[/td][td][/td][td]
2​
[/td][td]
2,9​
[/td][td]
0​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
8
[/td][td]
0,3​
[/td][td][/td][td]
3​
[/td][td]
1000000​
[/td][td]
2​
[/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
9
[/td][td]
0,0​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
10
[/td][td]
-1,1​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
11
[/td][td]
5,0​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
12
[/td][td]
-5,1​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
13
[/td][td]
-3,2​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
14
[/td][td]
11,1​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
15
[/td][td]
18,1​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
16
[/td][td]
-2,7​
[/td][td][/td][td][/td][td][/td][td][/td][/tr]

[tr][td="bgcolor: #DCE6F1"]
17
[/td][td][/td][td][/td][td][/td][td][/td][td][/td][/tr]
[/table]


Observe the numbers in red
C2 (a small negative number)
=-(10^6)

D8 (a big positive number)
=10^6

Array formula in E2 copied down
=MAX(FREQUENCY(IF((A$2:A$16>=C2)*(A$2:A$16<=D2),ROW(A$2:A$16)),IF(1-(A$2:A$16>=C2)*(A$2:A$16<=D2),ROW(A$2:A$16))))
Ctrl+Shift+Enter

Hope this helps

M.
 
Upvote 0
Hi Marcelo,
It works perfect. Thanks. If I increase the size of the data range but it contains blanks...how can I exclude those blanks in the formula?
 
Upvote 0
Try

E2 copied down
=MAX(FREQUENCY(IF(ISNUMBER(A$2:A$100)*(A$2:A$100>=C2)*(A$2:A$100<=D2),ROW(A$2:A$100)),IF(1-ISNUMBER(A$2:A$100)*(A$2:A$100>=C2)*(A$2:A$100<=D2),ROW(A$2:A$100))))
Ctrl+Shift+Enter

M.
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,189
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top