Count number of rows in sumif to reach a max value

gjackson2

New Member
Joined
Jan 15, 2014
Messages
1
Hello!
Long time reader, first time poster. Using MS Excel 2010. I need to count the number of rows in a sumif until a max value is reached.
In the example below, the data is sorted large to small by dollars. I need to know how many rows of category "CAR" are needed until max $ "6" is reached. The correct answer is 2. I can achieve the correct number of rows without the category using ={MATCH(D2,SUBTOTAL(9,OFFSET(B4,,,ROW(B4:B18)-ROW(B4))),1)}. But this does not factor in the category. I'd prefer a formula over vba and the actual data prohibits the use of helper columns because of other data pasted in around it in the report.

Thanks!

ABCD
1categorymax $
2CAR6
3categorydollars
4PLANE3.59
5HELI3.35
6PLANE3.27
7PLANE3.26
8CAR3.24
9CAR3.05
10CAR2.26
11PLANE2.25
12CAR1.95
13PLANE1.63
14CAR1.56
15HELI1.56
16HELI1.29
17HELI1.27
18HELI1.23

<tbody>
</tbody>
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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