Forum Discussion

PRisman's avatar
PRisman
Copper Contributor
Aug 10, 2022
Solved

Sum values across ROWS in LookUp

I have what should be an easy question...and yet...

 

Let's say I have a data table as follows:

 

Jan56
Feb92
Mar48
Apr87
May66
Jun99
Jul78
Aug83
Sep69
Oct72
Nov81
Dec59

 

My input is month, and I want to SUM values for the matching month and 2 previous months. So if the input value is "Sep", I want to return 69+83+78 = 230.

 

How can I do this?

3 Replies

  • Lorenzo's avatar
    Lorenzo
    Silver Contributor

    PRisman 

    If you want to avoid OFFSET...

    in E2:

    =SUM(INDEX(C2:C13, MATCH(E1,B2:B13,0)-2):INDEX(C2:C13, MATCH(E1,B2:B13,0)))

    or, with Excel 2021/365:

    =LET(
        m, XMATCH(E1,B2:B13),
        SUM(INDEX(C2:C13,m-2):INDEX(C2:C13,m))
    )
    • PRisman's avatar
      PRisman
      Copper Contributor
      whoa....... i would never have gotten there on my own... THANK YOU!!

Resources