VBA is unnecessary!
Plus since is uk Tax year starts 6/4/2009!
=DATEDIF(MAX(DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),MONTH(B4),DAY(B4)),DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),4,6)),TODAY(),"m")
Will give the full months in B4
=DATEDIF(MAX(DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),MONTH(B4),DAY(B4)),DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),4,6)),TODAY(),"m")+(DATEDIF(MAX(DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),MONTH(B4),DAY(B4)),DATE(YEAR(TODAY())-(AND(DAY(TODAY())<6,MONTH(TODAY())<=4)),4,6)),TODAY(),"md")/(DATE(YEAR(TODAY()),MONTH(TODAY())+1,0)-DATE(YEAR(TODAY()),MONTH(TODAY()),0)))
will give decimal months
Its slightly complicated due to the tax year starting 6/4 in the uk, if you want to use a different base date change all the 6's to the day the tax year starts for you!
Basically the formula decides which is the biggest, start of taxyear or startdate and uses that as a basis to work on
it then calculates the days since the start of the last month/ days in this month to get the fractional part
Bookmarks