Multiple sums query, is it possible?

dispelthemyth

Well-known Member
Joined
Mar 16, 2006
Messages
664
Office Version
  1. 365
Platform
  1. Windows
I am trying to sum 3 periods of time,
1) This month only
2) This month and last month
3) This month and the last 2 months
Snag_2369576a.png


As can be seen in June, i am trying to get an array of 30, 61 and 91 so i can use for a comparison

I have tried many formulas but nothing seems to work; an example For March, in D4 I have used
Excel Formula:
= SUM(OFFSET(B4, -{2;1;0}, 0, 3, 1))
(Used the sum so it doesnt spill for now, but i get 90, if i let it spill i get 3 #Value errors
Is it possible to get an array of sums with 3 cells, 2 cells and 1 cell?

EDIT:
I have also updated the formula to change the height to 3 rows, 2 rows and 1 rows as i mistakenly left it at 3 but it still gives a #value error with no sum wrapper and 90 with the sum wrapper

Excel Formula:
= SUM(OFFSET(B4, -{2;1;0}, 0, {3;2;1}, 1))
 
Last edited:

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I have also tried Index to Index like below which i would expect to output B2:B4; B3:B4; B4:B4 but again i get #value errors unless i wrap it with the Sum which then gets 90
Excel Formula:
= SUM(INDEX(OFFSET(B2, {0;1;2}, 0, 1, 1), 1, 1):INDEX(B4, 1, 1))
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
I am building the model for Office 365
Edit: Thanks, i have updated my signature, i didnt realise it was from a few years ago
 
Upvote 0
Upvote 0
Solution
Ok, how about
+Fluff 1.xlsm
ABC
1Month
201/01/202231
301/02/202228
401/03/202231{31;59;90}
501/04/202230{30;61;89}
601/05/202231{31;61;92}
701/06/202230{30;61;91}
801/07/202231{31;61;92}
901/08/202231{31;62;92}
1001/09/202230{30;61;92}
1101/10/202231{31;61;92}
1201/11/202230{30;61;91}
1301/12/202231{31;61;92}
Data
Cell Formulas
RangeFormula
B2:B13B2=DAY(EOMONTH(A2,0))
C4:C13C4=ARRAYTOTEXT(MMULT(--(SEQUENCE(3)>=SEQUENCE(,3)),INDEX(B2:B4,{3;2;1})),1)


But the values are text & not numbers.
Thank you very much, I believe this will give me exactly what i need, i can use the part inside the ArrayToText in my formula when i work on the next step of the model, you are a squire
Excel Formula:
= MMULT(--(SEQUENCE(3)>=SEQUENCE(,3)),INDEX(B2:B4,{3;2;1}))
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,588
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top