Calculating fiscal month number in Excel

This has come via this post at Mr Excel. and a response provided by Ron Coderre.

Assuming the fiscal year starts in April, the formula below will give you the fiscal month.


The value of ‘9’ is derived by the months remaining in the year that are the new financial year. In this case there are 9 months left in the year that are the new financial year (April, May, June, July, August, September, October, November, December)


Date tricks in Excel – Latest Month, and preceeding 12

Assuming you have your data formatted as a table (if not, why not) then you can use the following technique to see if it is the most current month for that set of date or if it is in the most recent n number of months.

For this example we assume that you have a simple list comprising of

  • Customer Name
  • Date order placed

You want to see the orders that were placed during the latest month you have data for.

The first thing will be to have a column to represent the month which is just a date format of the first of the month. This could be done in the formula later, but this reduced the complexity of the subsequent formula in that you always know that it will be the first of the month you are dealing with. Assuming you had a date in B1 (which is set to 29 June 2015), the formula to give the first of the month would be:


The date takes three parameters of year, month, and day and converts that to a date serial number, but instead of numbers we have put more functions. The year function returns the year of a date serial number as a four digit number.
The month function returns the number of the month of a date serial.
The final parameter is set to 1 – which puts the day element as the first of the month.
So with the date as 29/6/2015 the function evaluates to:


With this column in place and called month. we then use either of the following techniques.

Working out if Current month.

To work out if the row is in the current month you can use the following formula.


This compares the value of month in the row with the highest value in the entire month column. IF they are the same then the formula returns the string ‘Latest’ if not it returns ‘Previous’.

Working out in preceeding n months.

To work out if the value is in the preceeding n months, then use the following formula.
=IF([@[Order Date]]>=DATE(YEAR(MAX([Order Date])),MONTH(MAX([Order Date]))-13,1),"Previous 12","Older")

Cognos SQL

Automatically Reporting on Previous Calendar Month

This little snippet is used in a filter and automatically looks at the previous calendar month.

cast([Sales Team].[Client Contacts].[Start Date],date)

If the date is left as a timestamp then the last of the month is 2013-04-30 00:00 which means that a client contact that occurs at 9am would not be picked up. Casting it as a date ensures that it gets picked up as expected.

Another option is to add 1 day onto the _last_of_month, but that’s a hack.

The _add_months function can accept a negative number, which turns _add_months into _substract_months.