# Formula to update data each month

#### RobbieH

##### New Member
Need a formula, or possibly a macro if necessary, to execute the following based on the current month:

If the current month is January then if B1<E1 then D1=""; if B1>E1 then D1=
E1-
A1.
Cell D2 would be if B1+B2<E1 then D2=""; if
B1+B2>E1 then D2=
E1-
(B1+B2).
Cell D3 would be if B1+B2+B3<E1 then D3=""; if B1+B2+B3>E1 then D3=
E1-
(B1+B2+B3) etc., etc.,

EX: D1="", D2="", D3=-0.01
A B C D E
1 January 0.20 1
2 February 0.65
3 March 0.25
….
8 August 0.30
9 September 0.45
10 October 0.25
11 November 0.20
12 December 0.25

When the current month is February, I need to see February-July with January & August-December blank etc. etc. etc. The problem I keep encountering is when current month is August, I need data for August -January with Feb-July blank. The rollover is what gets me. The other kicker is the data for column B gets updated the 1st of each month to reflect the next 12 months so right now the data shows Feb 2019 through Jan 2020.

### Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

#### RobbieH

##### New Member
The formating changed from when I was typing this to when it submitted. "January" is A1, 0.20=B1, C1="", D1=the result, E1=manually input number (not always 1). Tried submitting screenshot and it didn't work either.

Replies
7
Views
113
Replies
1
Views
111
Replies
3
Views
110
Replies
5
Views
230
Replies
3
Views
319

1,195,748
Messages
6,011,432
Members
441,614
Latest member
TiaGtz

### 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.

### Which adblocker are you using?

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

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