Forum Discussion

Ka_ChunL's avatar
Ka_ChunL
Copper Contributor
Aug 04, 2025
Solved

Excel formula issue - YTD comparison with function Offset

Hi Expertise,

I have a problem needed your help. 

The following table with 2.5 year data from Jan 2023 to Jun 2025. The table with formula (sum & offset) to calculate the YTD of each year. When I add the data in Jun 2025, the YTD of 2023, 2024, 2025 can be automatically calculated from JAN to JUN. 

I found the formula under the first column "YEAR" and the last column "YTD" as below. When I save as the file, the calculation does not work again. May I ask you comment or help in this case? 

 

YearFormula           YTDFormula    
2023=Year(Report_Date)-2         60=SUM(B8:OFFSET(A8,0,COUNT(B8:M8)))
2024=Year(Report_Date)-1         120=SUM(B9:OFFSET(A9,0,COUNT(B9:M9)))
2025=Year(Report_Date)          180=SUM(B10:OFFSET(A10,0,COUNT(B10:M10)))
                   
YearJanFebMarAprMayJunJulAugSepOctNovDecYTD     
2023101010101010101010101010120     
2024202020202020202020202020240     
2025303030303030      180     
 
Thanks
Lawrence
  • Following m_tarler​ 's suggestion, perhaps in N7:

    =SUM(B7:OFFSET(A7,0,COUNT(B$9:M$9)))

    or

    =SUM(OFFSET(B7, 0, 0, 1, COUNT(B$9:M$9)))

    Fill down from N7 to N9.

5 Replies

  • m_tarler's avatar
    m_tarler
    Bronze Contributor

    For those YTD formulas I think you want the COUNT on row 10 (the 2025 year), like this:

    =SUM(B8:OFFSET(A8,0,COUNT(B10:M10)))

  • Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?

Resources