• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

calculate period based on a date (invoice date)

I would like to know if there is a function to calculates the month and the year for you based on a date in this format: "mm/dd/yyyy". The month to derive should be the month of the invoice date -1. For example if the invoice date is 01/10/2012 then the period should show: December, 2011. Another example: when the invoice date is 12/12/2011 then period should be November, 2011, etc...

Any help is most appreciated.
0
BauwensER
Asked:
BauwensER
  • 2
  • 2
  • 2
1 Solution
 
CluskittCommented:
If you just want the month, you can use:
Month(Dateadd(month,-1,InvoiceDate))
You can then format it any way you want.
You can also use (in VBA anyway):
Format(Dateadd(month,-1,InvoiceDate),"MMMM")
0
 
mbizupCommented:
Try this:

Format(DateAdd(YourDate,"m", -1), "mmmm, yyyy")
0
 
CluskittCommented:
To also show year, you can use the format with "MMMM, yyyy"
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
RunriggerCommented:
try something like this;

Format(DateAdd("m",-1,[date]),"Mmmm YYYY")
0
 
mbizupCommented:
I got the DateAdd arguments backwards in my comment.

The syntax, as the others have is:

DateAdd(Interval, Number,Date)
0
 
RunriggerCommented:
thank you very much
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now