Subtract dollar amount only after a certain date has passed

BiblioManiac

New Member
Joined
Jan 14, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I have inherited a spreadsheet that is used to calculate balances for in incentive program for nurses in my organization.

Nurses submit hours and earn $1.25 per hour. If they spend the amount they accumulated, that is recorded in the spreadsheet and that amount is substracted from their balances.

The organization recently enacted a two year expiration for these hours that is based on the month. So hours recorded in March 2020 would expire April 1, 2022. Hours recorded April 2020 would expire May 1, 2022 and so on.

The hours are also not supposed to expire if the nurse has spent part of the balance.

I almost have a working formula for this, but I cannot get the date aspect to work properly.

It is still subtracting from the balance even if the hours were entered in a month still within the 2 year timeframe.

Any assistance is greatly appreciated!

Example Spreadsheet1-5.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1 IDForwardedJan-20Feb-20Mar-20Apr-20May-20Jun-20Jul-20Aug-20Sep-20Oct-20Nov-20Dec-20Jan-21Feb-21Mar-21Apr-21May-21Jun-21Jul-21Aug-21Sep-21Oct-21Nov-21Dec-21Totals
210419309PIP Hrs84.084.036.036.051.012.012.048.024.048.036.0471.00
3$ Spent$198.27$168.09$366.36
4$ Earned$0.00$0.00$0.00$105.00$210.00$255.00$255.00$255.00$255.00$255.00$255.00$255.00$255.00$255.00$300.00$165.48$168.09$168.09$168.09$168.09$168.09$0.00$0.00$0.00$0.00$0.00
5Expired$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$0.00$12.39$0.00$15.00$0.00$60.00$30.00$60.00$45.00$0.0024
Sheet1
Cell Formulas
RangeFormula
AB2:AB3AB2=SUM(D2:AA2)
R4:AA4,D4:P4D4=MAX(C4+(D2*1.25)-D3-D5, 0)
Q4Q4=MAX(P4+(Q2*1.25)-Q3-Q6, 0)
AB4AB4=+AA4
D5D5=MAX(0,SUMIFS($D$2:D$2,$D$1:D$1,"<"&EDATE(D$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:C$5))
E5E5=MAX(0,SUMI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:P$5))
R5R5=MAX(0,SUMIFS($D$2:R$2,$D$1:R$1,"<"&EDATE(R$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:Q$5))
S5S5=MAX(0,SUMIFS($D$2:S$2,$D$1:S$1,"<"&EDATE(S$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:R$5))
T5T5=MAX(0,SUMIFS($D$2:T$2,$D$1:T$1,"<"&EDATE(T$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:S$5))
U5U5=MAX(0,SUMIFS($D$2:U$2,$D$1:U$1,"<"&EDATE(U$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:T$5))
V5V5=MAX(0,SUMIFS($D$2:V$2,$D$1:V$1,"<"&EDATE(V$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:U$5))
W5W5=MAX(0,SUMIFS($D$2:W$2,$D$1:W$1,"<"&EDATE(W$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:V$5))
X5X5=MAX(0,SUMIFS($D$2:X$2,$D$1:X$1,"<"&EDATE(X$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:W$5))
Y5Y5=MAX(0,SUMIFS($D$2:Y$2,$D$1:Y$1,"<"&EDATE(Y$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:X$5))
Z5Z5=MAX(0,SUMIFS($D$2:Z$2,$D$1:Z$1,"<"&EDATE(Z$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:Y$5))
AA5AA5=MAX(0,SUMIFS($D$2:AA$2,$D$1:AA$1,"<"&EDATE(AA$1,AB5))*1.25-SUM($AB$3)-SUM($C$5:Z$5))
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I went down a different road.

I create a data table
1644766409392.png


In the exclude column I created a formula to ignore earnings more than 24 months old unless some of those earnings had been spent (which I think it what you specified)

Then I created a pivot table, using the Include field as a slicer, January 2020 is excluded from the table because its more than 24 months old and there was no partial spending of the hours earned.
1644766493188.png


Perhaps this gives you another solution.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

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