Alternate to pivot table

sharshra

Active Member
Joined
Mar 20, 2013
Messages
352
Office Version
  1. 365
I have the following table & I want to generate a summary. This can be easily done using pivot tables. But, I would like to use lambda & related helper functions to achieve the same. At present, I´m getting the output with formula copied to each cell. I would like to avoid this & write formula in a single cell. The formula should get the data, header & the numbers. I´m faltering in getting the correct lambda function for this. Can the experts in this forum help please?

Source table:
excel problems.xlsx
BCDE
2idmodulenameresult
31Cdfdpass
42Ccvcfdffail
53Lwertewfail
64Lrpass
75Lqewno result
86Lioipass
97Chpass
108Cupass
119Cioifail
1210Lwewqpass
1311Lcvxzfail
1412Lhjgfail
1513Lewno result
1614Lyuipass
1715Ccxno result
1816Cadpass
1917Cgdfail
2018Ljgjpass
2119Lkjfail
2220Lxzpass
2321Cñkfail
2422Ckhpass
2523Chfpass
2624Cgdfail
2725Lfspass
Sheet1



Summary table:
excel problems.xlsx
GHIJK
2modulecount of namespassfailno result
3C12651
4L13742
Sheet1
Cell Formulas
RangeFormula
H3:H4H3=LET( tId, Table1[id], m, Table1[module], COUNT(UNIQUE(FILTER(tId,m=G3))))
I3:K4I3=LET( tId, Table1[id], m, Table1[module], r, Table1[result], ROWS(FILTER(r,(m=$G3)*(r=I$2))))
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
How about
Fluff.xlsm
ABCDEFGHIJK
1
2idmodulenameresultmodulecount of namespassfailno result
31CdfdpassC11651
42CcvcfdffailL13742
53Lwertewfail
64Lrpass
75Lqewno result
86Lioipass
97Chpass
108Cupass
119Cioifail
1210Lwewqpass
1311Lcvxzfail
1412Lhjgfail
1513Lewno result
1614Lyuipass
1715Ccxno result
1816Cadpass
1917Cgdfail
2018Ljgjpass
2119Lkjfail
2220Lxzpass
2321Cñkfail
2422Ckhpass
2523Chfpass
2624Cgdfail
2725Lfspass
Data
Cell Formulas
RangeFormula
G3:K4G3=LET(u,UNIQUE(Table1[module]),r,DROP(REDUCE("",u,LAMBDA(x,y,VSTACK(x,ROWS(UNIQUE(FILTER(Table1[name],Table1[module]=y)))))),1),HSTACK(u,r,COUNTIFS(Table1[result],I2:K2,Table1[module],u)))
Dynamic array formulas.
 
Upvote 0
As always, you are perfect @Fluff. This is what I was looking for (y) I wonder how can you make it so fast :cool:

The summary is correct. Is it possible to add the header also thru the formula, based on the source table instead of hard coding?

excel problems.xlsx
GHIJK
6modulecount of namespassfailno result
7C11651
8L13742
Sheet1
Cell Formulas
RangeFormula
G7:K8G7=LET(u,UNIQUE(Table1[module]),r,DROP(REDUCE("",u,LAMBDA(x,y,VSTACK(x,ROWS(UNIQUE(FILTER(Table1[name],Table1[module]=y)))))),1),HSTACK(u,r,COUNTIFS(Table1[result],I2:K2,Table1[module],u)))
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=LET(u,UNIQUE(Table1[module]),r,DROP(REDUCE("",u,LAMBDA(x,y,VSTACK(x,ROWS(UNIQUE(FILTER(Table1[name],Table1[module]=y)))))),1),h,TOROW(UNIQUE(Table1[result])),VSTACK(HSTACK("Module","Count of names",h),HSTACK(u,r,COUNTIFS(Table1[result],h,Table1[module],u))))
 
Upvote 1
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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