Switching to Google sheets from excel has meant that I have had to find a new formulas and methods to do this, which are documented here.
Simple method...
Assuming your date is in cell A3 the following formula will work fine=IF(MONTH(A3)<4, YEAR(A3)-1 &"/"&Right(YEAR(A3),2), YEAR(A3) &"/"&right(YEAR(A3)+1,2))
end result would be shown as for example
Date | Financial Year |
01/04/2013 | 2013/14 |
02/04/2013 | |
03/04/2012 |
More powerful method...
This is all well and good - but Google sheets have a fantastic ability to use an array, entering in a single formula in a cell and the sheet then automatically calculating for the whole column.=ArrayFormula(IF(MONTH(A3:A)<4, YEAR(A3:A)-1 &"/"&Right(YEAR(A3:A),2), YEAR(A3:A) &"/"&right(YEAR(A3:A)+1,2)))
End result
Date | Financial Year |
01/04/2013 | 2013/14 |
02/04/2013 | 2013/14 |
03/04/2012 | 2012/13 |
1899/00 | |
1899/00 | |
1899/00 | |
1899/00 |
Even better method...
As you can see from the example above, the array fills down all cells, giving a load of unwanted results where there is no date in column A.
The solution is to include another IF, which instructs only to fill down those cells where there is data in column A.
=ArrayFormula(IF(len(A3:A),IF(MONTH(A3:A)<4, YEAR(A3:A)-1 &"/"&Right(YEAR(A3:A),2), YEAR(A3:A) &"/"&right(YEAR(A3:A)+1,2)),iferror(1/0)))
Date | Financial Year |
01/04/2013 | 2013/14 |
02/04/2013 | 2013/14 |
03/04/2012 | 2012/13 |
04/04/2013 | 2013/14 |
05/04/2010 | 2010/11 |
06/04/2011 | 2011/12 |
07/04/2013 | 2013/14 |
08/04/2013 | 2013/14 |
09/04/2013 | 2013/14 |
Hope this is of use, especially to my NIHR colleagues!
This comment has been removed by the author.
ReplyDeleteThanks a lot. It solved my problem. You are the BOSS :-)
ReplyDeleteActually I was using similar formula (better formula rather) but idea of using it in arrayformula solved my problem.
My formula is like this:
= arrayformula( if(month(O6:O)>3,trim(to_text(year(O6:O)) & "-" & Right(to_TEXT(year(O6:O) + 1), 2)),trim(to_text(year(O6:O)-1) & "-" & Right(to_TEXT(year(O6:O)), 2))))
Glad this was of use :-) Thanks for the feedback
DeletePerfect : just no other word
ReplyDelete