Forum Discussion

Mr_Raj_C's avatar
Mr_Raj_C
Brass Contributor
Dec 03, 2023
Solved

Adding totals for two separate periods only where there is data.

Dear Excel Community, I'm hoping someone can assist with my conundrum !   Please see attached workbook. In the spreadsheet, i'm looking at data between two periods, 2022/23 vs 2023/24. The data is...
  • PeterBartholomew1's avatar
    Dec 04, 2023

    Mr_Raj_C 

    A couple of 365-specific ideas.  The first is to take a 22/23 value into account only if the corresponding 23/24 cell contains a number:

    = SUM(FILTER(food23, ISNUMBER(food24)))

    The second is to accumulate a running total up to but not including the first blank cell

    = LET(
        ADDλ, LAMBDA(a,f, a+f),
        accumulated23, SCAN(0, food23, ADDλ),
        XLOOKUP(FALSE, ISNUMBER(food24), accumulated23 - food23)
      )

    I prefer the first though.

     

Resources