Dynamic data rollup by Row - non specific criteria

Andy395

New Member
Joined
Jul 12, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I am trying to condense a large data set by creating a two tab 'machine'. One tab takes the raw data (50,000 rows +), and the second tab produces a rollup of the data while maintaining the same array width. (i.e. column positions need to respected).

I have tried using both FILTER and/or UNIQUE and it gets me very close, but something isn't quite right.

I have a range A2:T10000
Columns A,B,C,D,E,F,G,H,J,L,M,P,R,S,T comprise a unique ROW ID.
Columns I,K,N,O,Q are data that will need to be summed once the data set is rolled up.
Column P is that data that needs to be ignored to allow the data set to be rolled up.

So by ignoring the ID values in column P the overall Row ID becomes more generic allowing the data set to be collapsed into a more general grouping.

I am not able to use FILTER (array, {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1}) as this will remove the column. The column needs to remain as there will be one condition where the Column P ID will be retained (based on the date in column A), but this I can address separately with a VSTACK (maybe).

Does anyone know how to manipulate FILTER/UNIQUE so that I can paste a single 2D array equation in the A2 position of the rollup sheet, which will maintain the original data set column positions, ignore data in column P and sum the data in Columns I,K,N,O,Q after UNIQUE has created a reduced list?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
It is probably doable with a single but rather complicated fomula; therefore, could you please post some sample data (e.g. 10 rows)?
 
Upvote 0
I simplified the input a good amount, and it got pretty ugly when I did. But this takes the unique records for multiple columns and sums the values in those records. I think it's what you want in a smaller form.
MrExcelPlayground23.xlsx
ABCDEFGHIJKLMNOP
1NameAgeSNRankValueHairValue2NameAgeSNRankValueHairValue2
2James51123Captain5Black500James51123Captain64Black2523
3Fred45456General43Grey604Fred45456General62Grey9260
4Harry60789Captain5Brown156Harry60789Captain81Brown5644
5James51123Captain5Black346
6Fred45456General6Grey7567
7Harry60789Captain7Brown345
8James51123Captain45Black234
9Fred45456General4Grey65
10Harry60789Captain3Brown234
11James51123Captain2Black567
12Fred45456General5Grey346
13Harry60789Captain64Brown4453
14James51123Captain7Black876
15Fred45456General4Grey678
16Harry60789Captain2Brown456
Sheet11
Cell Formulas
RangeFormula
J2:P4J2=LET(a,A2:G16,b,CHOOSECOLS(a,1,2,3,4,6),c,UNIQUE(b),d,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHOOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,5)),e,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHOOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,7)),f,TAKE(d,ROWS(c)),g,TAKE(e,ROWS(c)),h,HSTACK(c,f,g),i,CHOOSECOLS(h,1,2,3,4,6,5,7),i)
Dynamic array formulas.
 
Upvote 0
So by ignoring the ID values in column P the overall Row ID becomes more generic allowing the data set to be collapsed into a more general grouping.
But if you want to keep col P in the output, how do you determine which values to keep?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
I simplified the input a good amount, and it got pretty ugly when I did. But this takes the unique records for multiple columns and sums the values in those records. I think it's what you want in a smaller form.
MrExcelPlayground23.xlsx
ABCDEFGHIJKLMNOP
1NameAgeSNRankValueHairValue2NameAgeSNRankValueHairValue2
2James51123Captain5Black500James51123Captain64Black2523
3Fred45456General43Grey604Fred45456General62Grey9260
4Harry60789Captain5Brown156Harry60789Captain81Brown5644
5James51123Captain5Black346
6Fred45456General6Grey7567
7Harry60789Captain7Brown345
8James51123Captain45Black234
9Fred45456General4Grey65
10Harry60789Captain3Brown234
11James51123Captain2Black567
12Fred45456General5Grey346
13Harry60789Captain64Brown4453
14James51123Captain7Black876
15Fred45456General4Grey678
16Harry60789Captain2Brown456
Sheet11
Cell Formulas
RangeFormula
J2:P4J2=LET(a,A2:G16,b,CHOOSECOLS(a,1,2,3,4,6),c,UNIQUE(b),d,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHHi OOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,5)),e,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHOOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,7)),f,TAKE(d,ROWS(c)),g,TAKE(e,ROWS(c)),h,HSTACK(c,f,g),i,CHOOSECOLS(h,1,2,3,4,6,5,7),i)
Dynamic array formulas.
Hi James, this is close, but needs to drop a term. If we look at your data set, what i'm trying to do is ignore the name and SN so that the values get rollup up by rank. In my data set column O would be the SN, and there would not be additional correlation to that individual (i.e. name and age). I'll try and put together a mini sheet
 
Upvote 0
But if you want to keep col P in the output, how do you determine which values to keep?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Hello, the criteria is the dates in column A. IF A:A >= EDATE(current month, -3) then take data set as is (no condensing). IF A:A < EDATE(current month, -3) then ignore data in column O and perform resulting SUMs based on new unique ROW ID.

I'll try out this xlbb thing.
 
Upvote 0
I simplified the input a good amount, and it got pretty ugly when I did. But this takes the unique records for multiple columns and sums the values in those records. I think it's what you want in a smaller form.
MrExcelPlayground23.xlsx
ABCDEFGHIJKLMNOP
1NameAgeSNRankValueHairValue2NameAgeSNRankValueHairValue2
2James51123Captain5Black500James51123Captain64Black2523
3Fred45456General43Grey604Fred45456General62Grey9260
4Harry60789Captain5Brown156Harry60789Captain81Brown5644
5James51123Captain5Black346
6Fred45456General6Grey7567
7Harry60789Captain7Brown345
8James51123Captain45Black234
9Fred45456General4Grey65
10Harry60789Captain3Brown234
11James51123Captain2Black567
12Fred45456General5Grey346
13Harry60789Captain64Brown4453
14James51123Captain7Black876
15Fred45456General4Grey678
16Harry60789Captain2Brown456
Sheet11
Cell Formulas
RangeFormula
J2:P4J2=LET(a,A2:G16,b,CHOOSECOLS(a,1,2,3,4,6),c,UNIQUE(b),d,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHOOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,5)),e,MMULT(--(TOROW(CHOOSECOLS(a,1))=CHOOSECOLS(b,1))*(TOROW(CHOOSECOLS(a,2))=CHOOSECOLS(b,2))*(TOROW(CHOOSECOLS(a,3))=CHOOSECOLS(b,3))*(TOROW(CHOOSECOLS(a,4))=CHOOSECOLS(b,4))*(TOROW(CHOOSECOLS(a,6))=CHOOSECOLS(b,5)),CHOOSECOLS(a,7)),f,TAKE(d,ROWS(c)),g,TAKE(e,ROWS(c)),h,HSTACK(c,f,g),i,CHOOSECOLS(h,1,2,3,4,6,5,7),i)
Dynamic array formulas.
Book1
ABCDEFGHIJKLMNOPQRST
1DateProjectDepartmentDepartment NameCost TypeComponentYear FiscalFiscal PeriodCost AmountOriginal currencyFxLabor SkillLabor CodeQtyNo. of HoursEmployeeOHActual budget?Parent% Complete
2Mar-24254687411Sales1BCA120243323.4USD1BCS103.5766360Actual4.10
3Mar-24254687311Marketing1BCA120243323.4USD1BCS103.5766360Actual3.10
4Mar-24254687220Finance1BCA120243739.2USD1BCS108767800Actual2.20
5Jun-24254687910Front office1DSA120246300.3USD1DSS103.25772920Actual9.10
6Jun-24254687443accounting1DSA120246693USD1DSS107.5793600Actual4.40
7Jul-23254687542engineering1DSA220237471USD1DSS207.5793340Actual5.40
8Jul-23254687542engineering1DSA220237471USD1DSS207.5793340Actual5.40
9Jun-242546871040stores1CDA12024692.4USD1CDS101783710Actual10.40
10Jan-242546871040stores1CDA32024125.36USD1CDS300.5792700Actual10.40
11Jan-23254687321shipping1ASA1202311039.37USD1ASS1011.5777820Actual3.20
12Jan-23254687321shipping1ASA12023110077.37USD1ASS10111.5795840Actual3.20
minisheet
 
Upvote 0
Hello, the criteria is the dates in column A. IF A:A >= EDATE(current month, -3) then take data set as is (no condensing). IF A:A < EDATE(current month, -3) then ignore data in column O and perform resulting SUMs based on new unique ROW ID.

I'll try out this xlbb thing.
I meant column P as per the original post (not O)
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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