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>
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Watch MrExcel Video

Forum statistics

Threads
1,123,494
Messages
5,602,004
Members
414,490
Latest member
Rip181

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
Top