Sum Values Above Based on Adjacent Value

MikeCobra

New Member
Joined
May 3, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
I am looking to see if this can be done as a formula but if it has to be VBA code then I can try and get it to work.

Basically, This file will track the Ins ( Column E) and Outs (Column F) of Totes. The outs will go out every day but the ins will only be delivered if the route is scheduled for a delivery that day. This can be seen in column I (Frequency). If there is the weekday in the Row (Column I). Then it will go out for delivery,

So if there is a day break between the delivery day (Column I - Frequency). The Wednesday IN (Column E) totes will be added to the Thursday in Totes as that is when they will be delivered.

So I would want the Formula to add all the values in Column E (In tote) above it that there isn't a value in Column I (Frequency) but not include the delivery Values before. So it calculates all the IN totes between the delivery days. (Column I - Frequency)

There is a chance that the delivery day could be everyday also

Please see attached screenshots as I have tried to clearly show what I want to happen. Along with color coding it so it is easy to read and understand.

I would prefer this to be done as a formula but if it has to be VBA code then I can try and get it to work as there will be multiple tables like this one.

Any other questions please let me know and I can try to provide more information.

Thank you for any help you can provide.
 

Attachments

  • Sum Values Based on Adjacent Frequency 1.PNG
    Sum Values Based on Adjacent Frequency 1.PNG
    25.5 KB · Views: 18
  • Sum Values Based on Adjacent Frequency 2.PNG
    Sum Values Based on Adjacent Frequency 2.PNG
    29.4 KB · Views: 18

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Is this it?
Book1
ABCDEF
1OpeningInOutCloseFrequency?
21003610126Tuesday36
3126361015236
41523610178Thursday72
5178361020436
6204020436
7204020436
8204311022567
92253110246Tuesday98
10246311026731
112673110288Thursday62
Sheet1
Cell Formulas
RangeFormula
F2:F11F2=IF(E1<>"",B2,B2+F1)
 
Upvote 0
Try the below :

Book6
ABCDEFGHI
1DateNumberOpeningInOutCloseFrequencyHelperOutcome
21003610126Tuesday1126
312636101162116
41163610178Thursday2178
517836101683168
616801683168
716801683168
816831101583158
91583110246Tuesday3246
1024631102364236
112363110288Thursday4288
Sheet1
Cell Formulas
RangeFormula
I2I2=IF(G2<>"",C2+D2-E2)
H3:H5H3=IF(G3<>"",H2,H2+1)
I3:I11I3=IF(G3="",I2-E3,I2+SUMIF($H$2:$H$11,H3,$D$2:$D$11)-E3)
H6:H11H6=IF(OR(G6<>"",G5=G6),H5,H5+1)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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