Count Rows Until A Certain Sum Value Is Reached based on addtl criteria

chefanator

New Member
Joined
May 31, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi - I am trying to sum the # of cells across a period of time until a certain threshold is reached from the value of those cells, but for multiple product codes in the same column. I was able to create the formula for sum until the threshold, but I am having trouble defining the second criteria for only focusing on the total units sold for a specific product. Can anyone assist. The formula I am using thus far is:

=MATCH(I$6,SUBTOTAL(9,OFFSET($C$7,,,ROW($C$7:$C$1000)-ROW($C$7))),1)

However, I need to add in an additional criteria to only focus on counting values in column C that match the product code in column H with the reference column A.

For example, in the attached screenshot, I want to find the "days to reach 50" for product 113 only.

Thanks in advance!

Screenshot 2022-05-30 083242.png


sales analysis.xlsx
ABCDEFGHIJKL
1
2OMIT(blank)
3NEWNEW
4threshold
5Sum of ordered_item_quantityproduct #50100250500
6product #dayTotal483
7481-Apr71133
8482-Apr101143
9483-Apr48115
10484-Apr53116
11485-Apr25117
12486-Apr29135
13487-Apr13137
14488-Apr12138
15489-Apr16141
164810-Apr18142
174811-Apr9143
184820-Apr6145
194826-Apr1147
20484-May1149
21485-May14150
22486-May10151
23487-May12156
24488-May14157
25489-May40
264810-May10
274811-May14
284812-May4
294813-May5
304814-May6
314815-May9
324816-May16
334817-May11
344818-May12
354819-May9
364820-May7
374821-May5
384822-May0
3911322-Jan13
4011323-Jan177
4111324-Jan40
4211325-Jan11
431136-Feb126
441137-Feb33
451138-Feb15
461139-Feb27
sales analysis
Cell Formulas
RangeFormula
H6:H24H6=UNIQUE($A$7:$A$963)
I6:I8I6=MATCH(I$5,SUBTOTAL(9,OFFSET($C$7,,,ROW($C$7:$C$1000)-ROW($C$7))),1)
Press CTRL+SHIFT+ENTER to enter array formulas.
Dynamic array formulas.
 
Thank you Fluff, this is exactly what I needed. I was reading about a dynamic array but wasn’t quite sure how to write it. thank you so much!
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Glad we could help & thanks for the feedback.
 
Upvote 0
How about
++Fluff.xlsm
ABCDEFGHIJKL
1
2OMIT(blank)
3NEWNEW
4threshold
5Sum of ordered_item_quantityproduct #50100250500
6product #dayTotal483415#N/A
74801-Apr7113225#N/A
84802-Apr100
94803-Apr48
104804-Apr53
114805-Apr25
124806-Apr29
134807-Apr13
144808-Apr12
154809-Apr16
164810-Apr18
174811-Apr9
184820-Apr6
194826-Apr1
204804-May1
214805-May14
224806-May10
234807-May12
244808-May14
254809-May40
264810-May10
274811-May14
284812-May4
294813-May5
304814-May6
314815-May9
324816-May16
334817-May11
344818-May12
354819-May9
364820-May7
374821-May5
384822-May0
3911322-Jan13
4011323-Jan177
4111324-Jan40
4211325-Jan11
4311306-Feb126
4411307-Feb33
4511308-Feb15
4611309-Feb27
Data
Cell Formulas
RangeFormula
H6:H8H6=UNIQUE($A$7:$A$963)
I6:L7I6=LET(f,FILTER($C$7:$C$963,$A$7:$A$963=$H6),r,ROWS(f),XMATCH(I$5,MMULT(--(SEQUENCE(r)>=SEQUENCE(,r)),f),1))
Dynamic array formulas.

Thank you for this! What if I wanted to sum the values in column C for the first 7 / 14 / 21 days in which values are present for?
 
Upvote 0
As this is a different question, it needs a new thread. Thanks
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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