Need a formula to sum penalty amount for values that fall outside of a specified range

BAvant

New Member
Joined
Aug 2, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I need to identify the total penalty incurred within a 30 day period using 30 minute interval data. The 30 minute interval data values are required to be between 39-42 and if they are not a $200 penalty is incurred. The part I'm having trouble with is that if a penalty is incurred there is a 12 hour rectification period so I would need the formula to skip the next 12 hours (24 rows) then begin searching for values outside of the range again and continue adding the $200 penalty as necessary.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Welcome to the MrExcel forum!

Interesting question! I tried to come up with a single cell formula, but came up short. Instead I added a helper column, then summed the column:

Book6
ABCD
1TimeValuePenaltyTotal Penalties
26/1/24 0:0042 2
36/1/24 0:3039 
46/1/24 1:00111
56/1/24 1:3011 
66/1/24 2:0012 
76/1/24 2:3013 
86/1/24 3:0014 
96/1/24 3:3015 
106/1/24 4:0040 
116/1/24 4:3041 
126/1/24 5:0016 
136/1/24 5:3040 
146/1/24 6:0042 
156/1/24 6:3041 
166/1/24 7:0042 
176/1/24 7:3045 
186/1/24 8:0039 
196/1/24 8:3042 
206/1/24 9:0045 
216/1/24 9:3039 
226/1/24 10:0040 
236/1/24 10:3042 
246/1/24 11:0040 
256/1/24 11:3041 
266/1/24 12:0041 
276/1/24 12:3039 
286/1/24 13:0039 
296/1/24 13:3041 
306/1/24 14:00251
316/1/24 14:3042 
326/1/24 15:0042 
336/1/24 15:3040 
346/1/24 16:0041 
356/1/24 16:3041 
366/1/24 17:0042 
Sheet1
Cell Formulas
RangeFormula
D2D2=SUM(C2:C1441)
C2:C25C2=IF(AND(OR(B2<39,B2>42),COUNTIF(C$1:C1,1)=0),1,"")
C26:C36C26=IF(AND(OR(B26<39,B26>42),COUNTIF(C2:C25,1)=0),1,"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B:BExpression=OR(B1>42,B1<39)textNO


Someone might be able to come up with a single cell formula, but it will likely require functions I don't have (I'm on Excel 2021).
 
Last edited:
Upvote 1
Solution

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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