Forum Discussion
PRisman
Aug 10, 2022Copper Contributor
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:
Jan | 56 |
Feb | 92 |
Mar | 48 |
Apr | 87 |
May | 66 |
Jun | 99 |
Jul | 78 |
Aug | 83 |
Sep | 69 |
Oct | 72 |
Nov | 81 |
Dec | 59 |
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?
Hi PRisman,
You can do this with MATCH(), OFFSET() and SUM(). See the example file attached.
In January and February that it doesn't work.
3 Replies
Sort By
- LorenzoSilver Contributor
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)) )
- PRismanCopper Contributorwhoa....... i would never have gotten there on my own... THANK YOU!!