# Count return of MAX

#### Sparky

##### Board Regular
If the MAX function returns an answer of say 20 but in the range it is refering to there are actually four instances of 20 what do I use to show the answer of 4

### Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

##### MrExcel MVP
one of many methodds:

=SUMPRODUCT((A1:A6=MAX(A1:A6))*(1))

#### Sparky

##### Board Regular

My range of cells is I7:I26,I29:I52,U3:U26,U29:U52
I used your suggest formula and get the VALUE error

#### zacemmel

##### Well-known Member
You cant test multiple arrays against a single array. You would have to do an "or" statement.

#### Sparky

##### Board Regular

You'll have to excuse my ignorance I'm not familiar with the OR function.

Thanks again

#### zacemmel

##### Well-known Member
Considering your arrays are of different length, I would try the following:

=SUM(IF(A3:A8=MAX(A3:A8, A6:A12),1,0))+SUM(IF(A12:A16=MAX(A3:A8,A12:A16),1,0))

Enter as an array and substitute your ranges in for the ranges I used. There is probably a much simpler way to do this, but I can't think straight right now ;p

#### Yogi Anand

##### MrExcel MVP

Hi Sparky:

Use...
=COUNTIF(I7:I26,"="&MAX(I7:I26))+COUNTIF(I29:I52,"="&MAX(I29:I52))+COUNTIF(U3:U26,"="&MAX(U3:U26))+COUNTIF(U29:U52,"="&MAX(U29:U52))

Regards!
Yogi Anand

#### zacemmel

##### Well-known Member
That won't account for the max in for EVERY range? It will only account for the max in the range you are checking?

##### MrExcel MVP
Given that the required max seems to be the max of several distinct ranges of cells (I7:I26,I29:I52,U3:U26,U29:U52
), how about the following, which is effectively equivalent to the other alternatives but is a little shorter to type:

1) select the distinct ranges all at once (by holding down the control key when you're doing it)
2) give the resulting selection a name in the name box to the left of the formula bar, e.g. maxrange
3) in a spare cell (e.g. C1), enter:

=max(maxrange)

4) calculate the desired count using a countif:

=COUNTIF(I7:I26,"="&C1)+COUNTIF(I29:I52,"="&C1)+COUNTIF(U3:U26,"="&C1)+COUNTIF(U29:U52,"="&C1)

##### MrExcel MVP
Given that the required max seems to be the max of several distinct ranges of cells (I7:I26,I29:I52,U3:U26,U29:U52
), how about the following, which is effectively equivalent to the other alternatives but is a little shorter to type:

1) select the distinct ranges all at once (by holding down the control key when you're doing it)
2) give the resulting selection a name in the name box to the left of the formula bar, e.g. maxrange
3) in a spare cell (e.g. C1), enter:

=max(maxrange)

4) calculate the desired count using a countif:

=COUNTIF(I7:I26,"="&C1)+COUNTIF(I29:I52,"="&C1)+COUNTIF(U3:U26,"="&C1)+COUNTIF(U29:U52,"="&C1)

Lets get fancy, though realistic...

With the morefunc.xll add-in installed, we can have...

In A1...

="{"&MCONCAT(I7:I126,",")&MCONCAT(I129:I152,",")&MCONCAT(U23:U26,",")&MCONCAT(U29:U52,",")&"0}"

In A2...

=EVAL("MAX"&"("&A1&")")

In A3...

=EVAL(SUMPRODUCT((EVAL(A1)=A2)+0))

In A4, instead of A2 and A3...

=EVAL(SUMPRODUCT((EVAL(A1)=EVAL("MAX"&"("&A1&")"))+0))

This message was edited by Aladin Akyurek on 2002-10-29 07:23

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,164,682
Messages
5,838,787
Members
430,569
Latest member
sbardelli

### 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.

### Which adblocker are you using?

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

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