Formula for Trading year from date

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Formula for Trading year from date

Post by StuartR »

I have a spreadsheet with a date in column B on every row. I need to filter the data by "Trading year".

Year 1 runs from 1 Nov 2013 to 31 Oct 2014
Year 2 runs from 1 Nov 2014 to 31 Oct 2015
etc.

Can someone please suggest a simple formula so that I can add a "trading year" column that I can use to filter the data.
StuartR


User avatar
Jan Karel Pieterse
Microsoft MVP
Posts: 656
Joined: 24 Jan 2010, 17:51
Status: Microsoft MVP
Location: Weert, The Netherlands

Re: Formula for Trading year from date

Post by Jan Karel Pieterse »

Something like:

Code: Select all

=YEAR(A1)-IF(MONTH(A1)<11,1,0)
Regards,

Jan Karel Pieterse
Excel MVP jkp-ads.com

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Formula for Trading year from date

Post by StuartR »

That's brilliantly simple. Thank you.
StuartR


User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Formula for Trading year from date

Post by HansV »

Alternatively:

=YEAR(EDATE(A1,-10))
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Formula for Trading year from date

Post by StuartR »

That works too Hans, but I found Jan Karel's formula easier to understand
StuartR


User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Formula for Trading year from date

Post by Rudi »

EDATE just calculates the amount of months before or after the given date...
1.jpg
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Formula for Trading year from date

Post by StuartR »

Rudi,

Yes, I looked at the help and realized how it works. Thank you.
StuartR


User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Formula for Trading year from date

Post by Rudi »

The hardest part of EDATE is to work out what the "E" stands for?
It would have been more appropriate to name it MDATE (for month)!!
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Formula for Trading year from date

Post by StuartR »

I ended up using EDATE as I needed to repeat it within the formula and it made everything a bit shorter. My final formula was
=IF(C3<>"",YEAR(EDATE(C3,-10)) & "-" & YEAR(EDATE(C3,2)),"")

Which produces
2013-2014
2014-2015
etc.
and leaves the cell blank on rows that haven't been completed yet
StuartR


User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Formula for Trading year from date

Post by HansV »

Rudi wrote:The hardest part of EDATE is to work out what the "E" stands for?
It would have been more appropriate to name it MDATE (for month)!!
I think it stands for "Effective Date", as in "the effective date is 2 months from now".

An eDate, on the other hand, is something entirely different...
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12602
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Formula for Trading year from date

Post by StuartR »

Thank you to everyone for your help, and the enlightening asides. I have now replaced lots of SUMIF() formulae with SUMIFS() and my financial spreadsheet now correctly allows me to select a financial year and displays just the data for that year.
StuartR