Index - Match?

whynot

Board Regular
Joined
Jun 27, 2009
Messages
118
Office Version
  1. 365
Platform
  1. Windows
I am trying to calculate the total for the quarters for each year of data. I have data for Jan - Dec for each year need to add jan/feb/mar for 1Q, apr/may/jun for 2Q and so on.
i have included the data and how i am trying to set up my worksheet.
Thank you for the help.
New Business - Bankruptcy 1.0.xlsm
ABCDEFGHIJKLM
8YearJanFebMarAprMayJunJulAugSepOctNovDec
92004NANANANANANA159,082192,342191,244191,350211,421192,407
102005202,217204,563201,763204,009203,455209,859207,622205,015184,506231,096222,702232,562
112006216,896225,947222,581223,185221,944218,056219,937219,163212,135207,343202,446245,856
122007207,294217,667216,139214,451220,622221,664221,083218,517226,413233,804213,636244,205
132008207,604210,131220,461219,286215,957210,643209,790222,638210,820205,724204,657186,183
142009207,474194,915198,816198,944199,968202,963207,318201,742206,207203,978207,895200,498
152010201,269202,004203,545206,315210,950204,740207,641207,774214,216214,170221,758205,425
162011219,956223,776213,451213,884186,327219,893216,774213,176212,481205,716221,436228,269
172012185,170214,138216,854217,905220,401208,459208,296208,916206,880212,717202,237274,308
182013220,228211,882216,620213,226206,786217,010218,197221,631212,617223,736221,701227,846
192014210,241222,275228,104225,967223,040226,268222,001226,366228,118226,970222,036205,462
202015256,949229,473229,317231,164224,660233,832237,200234,449240,074243,418237,012225,459
212016260,889241,206236,843243,958254,506216,326260,952248,133254,858245,298252,824259,738
222017264,310260,122262,192261,436260,902267,070267,812269,612260,729272,776282,070267,655
232018297,586285,342289,145285,433291,926296,177292,202296,131291,231286,622291,106296,119
242019277,317298,253300,259292,614285,547290,506282,573292,273292,756299,023293,781309,607
252020282,802300,705257,673234,838294,957377,081552,748485,701437,527414,335395,397347,651
262021481,831428,386453239489588495976446039448197428523432170431427431017418884
272022428443419130416551423153NANANANANANANANA
28
291Q14
302Q14
313Q14
324Q14
331Q15
342Q15
353Q15
364Q15
371Q16
382Q16
393Q16
404Q16
411Q17
422Q17
433Q17
444Q17
451Q18
462Q18
473Q18
484Q18
491Q19
502Q19
513Q19
524Q19
531Q20
542Q20
553Q20
564Q20
571Q21
582Q21
593Q21
604Q21
611Q22
SA BA
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Here is one idea:
MrExcel_20220512B.xlsx
ABCDEFGHIJKLM
8YearJanFebMarAprMayJunJulAugSepOctNovDec
92004NANANANANANA159082192342191244191350211421192407
102005202217204563201763204009203455209859207622205015184506231096222702232562
112006216896225947222581223185221944218056219937219163212135207343202446245856
122007207294217667216139214451220622221664221083218517226413233804213636244205
132008207604210131220461219286215957210643209790222638210820205724204657186183
142009207474194915198816198944199968202963207318201742206207203978207895200498
152010201269202004203545206315210950204740207641207774214216214170221758205425
162011219956223776213451213884186327219893216774213176212481205716221436228269
172012185170214138216854217905220401208459208296208916206880212717202237274308
182013220228211882216620213226206786217010218197221631212617223736221701227846
192014210241222275228104225967223040226268222001226366228118226970222036205462
202015256949229473229317231164224660233832237200234449240074243418237012225459
212016260889241206236843243958254506216326260952248133254858245298252824259738
222017264310260122262192261436260902267070267812269612260729272776282070267655
232018297586285342289145285433291926296177292202296131291231286622291106296119
242019277317298253300259292614285547290506282573292273292756299023293781309607
252020282802300705257673234838294957377081552748485701437527414335395397347651
262021481831428386453239489588495976446039448197428523432170431427431017418884
272022428443419130416551423153NANANANANANANANA
28
291Q14660620
302Q14675275
313Q14676485
324Q14654468
331Q15715739
342Q15689656
353Q15711723
364Q15705889
371Q16738938
382Q16714790
393Q16763943
404Q16757860
411Q17786624
422Q17789408
433Q17798153
444Q17822501
451Q18872073
462Q18873536
473Q18879564
484Q18873847
491Q19875829
502Q19868667
513Q19867602
524Q19902411
531Q20841180
542Q20906876
553Q201475976
564Q201157383
571Q211363456
582Q211431603
593Q211308890
604Q211281328
611Q221264124
Sheet8
Cell Formulas
RangeFormula
B29:B61B29=SUM(INDEX($B$9:$M$27,MATCH(2000+RIGHT($A29,2),$A$9:$A$27,0),SEQUENCE(1,3,3*(LEFT($A29,1)-1)+1,1)))
 
Upvote 0
Two more options... Unfortunately, when the quarter and year are combined in a text string (such as 4Q21), extra work is needed to extract the 4 and the 21 in order to determine which row and set of columns in the main table need to be summed.
MrExcel_20220512B.xlsx
ABCD
291Q14660620660620660620
302Q14675275675275675275
313Q14676485676485676485
Sheet8
Cell Formulas
RangeFormula
B29:B31B29=SUM(INDEX($B$9:$M$27,MATCH(2000+RIGHT($A29,2),$A$9:$A$27,0),SEQUENCE(1,3,3*(LEFT($A29,1)-1)+1,1)))
C29:C31C29=SUM(INDEX(FILTER($B$9:$M$27,RIGHT($A$9:$A$27,2)=RIGHT($A29,2)),,CHOOSE(LEFT($A29,1),{1,2,3},{4,5,6},{7,8,9},{10,11,12})))
D29:D31D29=SUM(INDEX(FILTER($B$9:$M$27,RIGHT($A$9:$A$27,2)=RIGHT($A29,2)),,SEQUENCE(1,3,3*(LEFT($A29,1)-1)+1,1)))
 
Upvote 0
I used your first suggestion and it worked perfectly.
Are there instances, where it will not work, is that why suggested the other idea.
Thank you very much for your help!!
You saved me a ton of time!!
 
Upvote 0
Great!...and an interesting question. The three are similar and should give the same results for data as presented for years in the 21st century and months arranged in order from Jan-Dec. The first takes the last two digits from your summary list leftmost column and adds 2000 to obtain the year, which is then matched to the data table. Should the data table contain 20th century data (e.g., 1999), a match would not be found and an error would be generated. The other two options match the rightmost two digits on the assumption that those years come from the same century, so those formulas would be vulnerable to giving incorrect matches/answers if, say, the data table contained historical data from 1920, 1820, etc. Then there would be no way to distinguish between those and the entry for 2020. I doubt any of these are issues. And all will generate an error if a non-existing/nonsense quarter number (e.g., 5) or year (e.g. 2003) is used in the summary list, as the formulas will not find matches in the data table. There are often multiple ways to produce the same results in Excel, but some formulas are more efficient or easier to understand/maintain.
 
Upvote 0
Thank you very much for the explanation. If I do not need to go back to say 1920's i will obviously have to figure out a different formula or method. However, the formula you provided does exactly what i need. The explanation helped me understand the logic. Although, i could have never figured out the formula myself. In fact, there are parts of the formula I don't understand. I just have to hope it does not break. But the spreadsheet has several other formulas that are complicated that, someone like yourself with an immense amount of expertise in excel, helped me build.

Once again thank you very much!!
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,710
Members
449,182
Latest member
mrlanc20

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