Help with formula consolidating Data

Newbie73

Board Regular
Joined
Feb 4, 2024
Messages
109
Office Version
  1. 365
Platform
  1. Windows
Hello everyone,

I need some help with a formula that I can't get my head around it. Example sheet provided:

test1.xlsx

Column A has IDs which often will be duplicated. Column B has a number from a test specific to the ID on Column A of that row and then Column C dates for those tests.

So what I would like to do is to consolidate these data as in, all the results for each ID from Column A sorted per year and If more than one result (column B) different than zero from the same year then sum the value.

There's a wanted result on the example sheet which hopefully it will help.

Thank you in advance for your help and please do tell if I didn't explain something correctly or if you need any more informations.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
How about
Excel Formula:
=LET(f,FILTER(HSTACK(A2:B100,YEAR(C2:C100)),B2:B100<>0),u,UNIQUE(HSTACK(CHOOSECOLS(f,1,3))),b,BYROW(u,LAMBDA(br,SUM(IF((INDEX(f,,1)=INDEX(br,,1))*(INDEX(f,,3)=INDEX(br,,2)),INDEX(f,,2))))),CHOOSECOLS(HSTACK(u,b),1,3,2))
 
Upvote 0
How about?:

Book6.xlsx
ABCDEFG
1wanted result
2PTTT70640140205/6/2014PTTT70630259812020
3PTTT706401402012/17/2013PTTT70630259812019
4PTTT70640140209/30/2013PTTT70670260232023
5PTTT70640140206/10/2013
6PTTT70640140202/12/2013PTTT70630259812020
7PTTT706401402010/15/2012PTTT70630259812019
8PTTT6241201406011/28/2023PTTT70670260232023
9PTTT624120140609/26/2023
10PTTT624120140606/20/2023
11PTTT624120140604/4/2023
12PTTT70630259813/17/2020
13PTTT706302598112/17/2019
14PTTT70630259809/9/2019
15PTTT70630259805/21/2019
16PTTT70630259802/25/2019
17PTTT706302598010/29/2018
18PTTT70630259807/18/2018
19PTTT70630259804/18/2018
20PTTT70630259801/9/2018
21PTTT706702602011/28/2023
22PTTT70670260209/26/2023
23PTTT70670260216/20/2023
24PTTT70670260204/4/2023
25PTTT70670260201/3/2023
26PTTT70670260226/26/2023
Sheet6
Cell Formulas
RangeFormula
E6:G8E6=LET(id,A2:A26,c,B2:B26,y,YEAR(C2:C26), u, UNIQUE(HSTACK(id,y)), cv, BYROW(u, LAMBDA(x, SUM(FILTER(c, (id=CHOOSECOLS(x, 1))*(y=CHOOSECOLS(x, 2)))))), r, HSTACK(CHOOSECOLS(u, 1), cv, CHOOSECOLS(u, 2)), FILTER(r, cv) )
Dynamic array formulas.
 
Upvote 0
Thank you both! Tried both formulas and they both seem to work as intended!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
May I ask just one more addition to the formula? I've added a another column into the example sheet, usually either "CLEAR" "IR" or "R" if it matters.

Any way if in a year that the ID was "R" or "IR" to be added in as well? With priority to "R" as in, if in the same year the same ID was "IR" and "R" to simply say "R". If "CLEAR" it ca be ignored and blank.

Thanks and sorry to bother again!
 
Upvote 0
Correcting something on my comment above, if "R" on Column D of that year then "2" on Column H and if "IR" then "1" as this will help me on another formula afterwards. If "CLEAR" leave blank please.

Updated the example sheet.
 
Upvote 0
How about
Excel Formula:
=LET(f,FILTER(HSTACK(A2:B100,YEAR(C2:C100),D2:D100),B2:B100<>0),u,UNIQUE(HSTACK(CHOOSECOLS(f,1,3))),b,BYROW(u,LAMBDA(br,SUM(IF((INDEX(f,,1)=INDEX(br,,1))*(INDEX(f,,3)=INDEX(br,,2)),INDEX(f,,2))))),c,BYROW(u,LAMBDA(br,SUM(IF((INDEX(f,,1)=INDEX(br,,1))*(INDEX(f,,3)=INDEX(br,,2))*((INDEX(f,,4)="ir")+(INDEX(f,,4)="r")),1,0)))),CHOOSECOLS(HSTACK(u,b,c),1,3,2,4))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,788
Messages
6,174,570
Members
452,573
Latest member
Cpiet

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