Find first and last value of month, to calculate monthly change

Jarke

Board Regular
Joined
Aug 13, 2016
Messages
95
Hello folks, need som help with finding value on a certain date to calculate monthly change!

I want to calculate the percentage changed every month, and so i got transactions every month, but not always is it the first or last in the month, to find right dates? could perhaps go from last transaction previous month to last transaction this month to get what happened within the month.

This is my code to sum what happened during the month.
=SUMPRODUCT((MONTH(Logg!$C$24:$BN$24)=C75)*(YEAR(Logg!$C$24:$BN$24)=2016)*(Logg!$C$60:$BN$60))

And obviously i need to subtract or add the ingoing "bankaccount" with the transaction sum of the month, and then divide this with the ingoing bankaccount value to get the percentage changed.

Nuff said, i also have the bank value being changed with each transaction and date, and i want a code to find the right date, and thereby the right value.

Ooor, as i have the "bankvalue" after each transaction, a code that will find the first logged bankvalue of the month and the last, this could do the trick. But how will i code this?

Hope i made it clear enought, please ask otherwise

Best regards
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Maybe something like this.
These are array formulas and must be entered with CTRL-SHIFT-ENTER.

Formula in C76 will return last value from Dec. if the month in C75 = 1.

Excel Workbook
BCDEFGHIJKLM
2412/3/201512/31/20151/1/20161/5/20162/2/20162/8/20162/25/20163/2/20163/5/20163/20/20163/28/2016
25
59
6012345671591211
74
75Month2
76End of last Month4
77End of Month from C757
78
Logg
 
Upvote 0
Hi m8, thanks for you effort and great reply, looks terrific! I got some problems tho with entering your formula.. I know that it should be arrays. But i got alot of errors in the code, i got excel 2010. And i always have problems with other peoples yet correct formulas, i think my excel don't like comma ",".

I took away the arrays and let excel show me where there was problems, and it wanted to change all the commas ",". So i switched all these to ";". This worked on your C77!

The furthest i came on the C76 is that the cell says #NAME?. I also know that "*" has worked instead of comma "," before. Any idéa on how to retype the big formula C76?

Thanks again, and great work!
 
Upvote 0
See if this works (changed "," to ";").

Code:
=IFNA(INDEX(Logg!$C$60:$BN$60;MATCH(MAX(IF(MONTH(Logg!$C$24:$BN$24)=C75-1;IF(YEAR(Logg!$C$24:$BN$24)=2016;Logg!$C$24:$BN$24)));Logg!$C$24:$BN$24,0));INDEX(Logg!$C$60:$BN$60;MATCH(MAX(IF(MONTH(Logg!$C$24:$BN$24)=12;IF(YEAR(Logg!$C$24:$BN$24)=2016-1;Logg!$C$24:$BN$24)));Logg!$C$24:$BN$24,0)))
 
Upvote 0
No it does not work, it doesn't like the comma before the zeroes either, and changing them to ";" does not help(Cell just shows #NAME?). Frustrating >_<
 
Upvote 0
See what this gives you. Your month in C75 will have to be 2 or greater (it will fail if month is 1 as C75-1 would equal 0). Also, make sure all the cell references are correct.
Code:
=INDEX(Logg!$C$60:$BN$60;MATCH(MAX(IF(MONTH(Logg!$C$24:$BN$24)=C75-1;IF(YEAR(Logg!$C$24:$BN$24)=2016;Logg!$C$24:$BN$24)));Logg!$C$24:$BN$24,0))
 
Upvote 0
It worked! Just changed the comma before the zero in the end to ";". Thanks alot! This would have taken me days, be well friend.

PS. I now figured out a very easy wait to solve the problem, as i have every month in a columm, 1,2,3,4,5.... i could just change the C77 formula, and add =C74 instead of C75.

Best regards
 
Upvote 0
You're welcome. Glad you got it to work. Thanks for the feedback.
 
Upvote 0
Hi! I'm going to do the same with weekly now, should be easier i suppose. I want the weekly change, so last bank value from last week and the last this week should do the trick.

Here's the code to sum the weekly result, =SUMPRODUCT((YEAR(Logg!$C$24:$BN$24)=2016)*(Logg!$C$63:$BN$63=B36)*(Logg!$C$60:$BN$60<>0)*(Logg!$C$60:$BN$60))

Daily date is in row 24, result is in row 60, the dates weekly number is in row 63, bank value after each transaction is in row 65.

Hope you can help me! Should probably be something like the monthly code you made.

Thanks, best regards
 
Upvote 0
Here is one way.
Also, instead of hard coding in the year 2016, I would probably put this into a cell and reference it. That way if your data goes over multiply years you can just change the one cell and not have to change all the formulas.
As always change cell references to match your data.

These are array formulas and must be entered with
Excel Workbook
ABCDEFGHIJKLMNO
24Date12/3/201512/31/20151/1/20161/5/20162/2/20162/3/20162/5/20162/16/20163/2/20163/5/20163/6/20163/7/20163/9/2016
25
6012345-6715912201125
61
62
63Week49531266681010111111
64
65Bank12345-6715912201125
66
67Week #11
68Last Week12
69This Week25
CTRL-SHIFT-ENTER.
 
Upvote 0

Forum statistics

Threads
1,216,028
Messages
6,128,400
Members
449,448
Latest member
Andrew Slatter

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