ISO Year

Ron de Bruin has an ISO Date page for computing ISO Week numbers, start dates, and end dates. I needed to compute the ISO year, which should just be the YEAR() function wrapped around the end date formula. But I was getting strange results for the first three days of January this year, so I modified the formulas

B2: =DATE(YEAR(A2-WEEKDAY(A2-1)+4),1,1)-MOD(DATE(YEAR(A2-WEEKDAY(A2-1)+4),1,1)-2,7)+(7*(MOD(DATE(YEAR(A2-WEEKDAY(A2-1)+4),1,1)-2,7)>3))
C2: =DATE(YEAR(A2-WEEKDAY(A2-1)+4)+1,1,1)-MOD(DATE(YEAR(A2-WEEKDAY(A2-1)+4)+1,1,1)-2,7)+(7*(MOD(DATE(YEAR(A2-WEEKDAY(A2-1)+4)+1,1,1)-2,7)>3))-1
D2: =YEAR(DATE(YEAR(A2-WEEKDAY(A2-1)+4),1,1)-MOD((DATE(YEAR(A2-WEEKDAY(A2-1)+4),1,1)-2),7)+

They’re the same as Ron’s except it uses the WEEKDAY() offset in the DATE() calculations. The purpose of these is to supply a date and return the start of the ISO year, the end of the ISO year, and the ISO year number, respectively.

Posted in Uncategorized

5 thoughts on “ISO Year

  1. Hi Dick

    The formula examples on my page are based on the year and you are correct that
    you see strange results when the date is before 4-jan-2010 if your input is a date.

  2. Hi Dick


    I will update the page/workbook when I am ready with some stuff I am working now
    I have a few other formulas also that are shorter for ISO that I want to add

  3. This is a very timely update (no pun intended). As we become increasingly global in our businesses, having to deal with dates has been quite an interesting ordeal. I also read the original page and found it to be informative and useful.

    Thank you for taking the time to share the solution and the spreadsheet.

  4. Before you led me via Ron to D Maher’s & C Pearson’s efficient calculation for ISO Week Number, I had created an elaborate UDF based on VBA’s DatePart function. If anyone else has gone down that road, you should know there is a bug waiting for you.

    DatePart(“ww”, theDate, vbMonday, vbFirstFourDays)

    gives a good ISO week number, except for these dates (in my sample range):
    The function returns week 53 (day 1). The day following each correctly returns week 01 (day 2).
    (I’m Excel 2003 on XP)

    There’s another glitch at 2101-01-02, but I haven’t investigated, gonna go with the slick formula instead.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.