Date formula

Jyggalag

Active Member
Joined
Mar 8, 2021
Messages
445
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi all,

I am calculating depreciations like this:
1728481543102.png


However, my formula ONLY calculates depreciation for january if the date in column B = 01-01-2024.

Is there any way to change it, so it calculates this as long as the date in column B is in the same month as in the date mentioned in column F? and i need to pull the formula to the right to future months, so feb-24, mar-24.... jan-25.... mar-26 etc.

Would really appreciate some help! :)
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
There is no need to prefix your formula with a "+" sign.
There is no need to use the VALUE function when the cell contains a numeric value (which includes date/time values).

You have not given complete information here but if we assume that F3 contains a date (and not the text "jan-24") then the formula is:

Excel Formula:
=IF(EOMONTH($F3;0)=EOMONTH($B7;0);$E7;0)
 
Upvote 0
I suppose that's true. This is a matter of style, I think. I tend to prefer formulas and code that are more explicit in what they do vs. the most economical solution, unless performance becomes an overriding issue.
 
Upvote 0
if we assume that F3 contains a date (and not the text "jan-24") then the formula is:
It looks like a table to me which means the headings are text BUT the EOMonth function seems to be converting it without any issue.

Both solutions have the referencing swapped around and the comparitive operator changed and since I am in Jeff's camp of being more explicit the end result should look like this.
Rich (BB code):
=IF(EOMONTH(F$3;0)>=EOMONTH($B7;0);$E7;0)
 
Upvote 0
Why do you need ">"? EOMONTH(x, 0) will return the same date for any day in a given month. If both dates are in the same month, then EOMONTH will be "=" for them.

OP had ">=" in the original formula, but that wasn't doing what OP wanted. The problem statement was " the date in column B is in the same month as in the date mentioned in column F?"
 
Upvote 0
Hi Jeff, It must be the accountant coming out in me ;)
Its a depreciation schedule for the year (or some future period). He will then copy across the formula to the future months so it first starts in the month in column B and then repeats in every month thereafter. Typically using the start date and depreciation period the formula would also calculate when it should stop repeating.
 
Upvote 0
It looks like a table to me which means the headings are text BUT the EOMonth function seems to be converting it without any issue.

Both solutions have the referencing swapped around and the comparitive operator changed and since I am in Jeff's camp of being more explicit the end result should look like this.
Rich (BB code):
=IF(EOMONTH(F$3;0)>=EOMONTH($B7;0);$E7;0)
Dear Alex,

This formula works, thank you so much!

One final request (if I may): The formula currently calculates in infinity. This means that if I set, as an example:
Depreciation start date = Jan-24
Depreciation period = 1 year

and I then post the formula to a month past Jan-25, for example, Mar-26, it will still calculate depreciation in this month, even though one year has passed.

Is there any way in which the formula can be altered to account for this? :)
 
Upvote 0
Give this a try:
Excel Formula:
=IF(
   AND(EOMONTH(F$3,0)>=EOMONTH($B7,0),
       EOMONTH(F$3,0)<EOMONTH($B7,$D7*12)),
   $E7,0)
 
Upvote 0

Forum statistics

Threads
1,223,104
Messages
6,170,125
Members
452,303
Latest member
c4cstore

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