I´m using dynamic arrays to get the required output as mentioned below. There are few problems to be solved with this. Can the experts help please?
Source table contains name, dept & case 3. From this, I need a table which shows for each name, number of cases & dept. I´m getting partially correct output, but there are few problems to be fixed / improvements to be done.
1. For each name, I´m getting the all dept & cases together. I want to make them separate. For example, name abc should have a line each for finance & sales with count & cases also shown separately.
2a. When there is no name, count is shown calculation error. How to fix it?
2b. When there is no name, I want to show 'no name´ instead of blank. When I use IF to get 'no name', it resulting in calculation error. How to fix it? Refer the last table.
3. In the formula, only difference between nDept & caseName is the array name in FILTER. I want to create a reusable LAMBDA function within the formula & reuse. I don´t want to create thru name manager. How can it be done?
Source table:
Desired output:
Dynamic array formula used:
Calculation when 'no name' inserted for blank names:
Source table contains name, dept & case 3. From this, I need a table which shows for each name, number of cases & dept. I´m getting partially correct output, but there are few problems to be fixed / improvements to be done.
1. For each name, I´m getting the all dept & cases together. I want to make them separate. For example, name abc should have a line each for finance & sales with count & cases also shown separately.
2a. When there is no name, count is shown calculation error. How to fix it?
2b. When there is no name, I want to show 'no name´ instead of blank. When I use IF to get 'no name', it resulting in calculation error. How to fix it? Refer the last table.
Excel Formula:
IF(UNIQUE(name)="", "no name",UNIQUE(name))
3. In the formula, only difference between nDept & caseName is the array name in FILTER. I want to create a reusable LAMBDA function within the formula & reuse. I don´t want to create thru name manager. How can it be done?
Source table:
excel problems.xlsx | |||||
---|---|---|---|---|---|
B | C | D | |||
2 | name | dept | case # | ||
3 | abc | finance | 2 | ||
4 | abc | finance | 32 | ||
5 | def | finance | 32 | ||
6 | efg | finance | 11 | ||
7 | bcd | hr | 8 | ||
8 | hr | 60 | |||
9 | hr | 55 | |||
10 | cde | procurement | 76 | ||
11 | procurement | 46 | |||
12 | abc | sales | 93 | ||
13 | def | sales | 45a | ||
14 | mno | security | 37 | ||
filter |
Desired output:
excel problems.xlsx | ||||||
---|---|---|---|---|---|---|
F | G | H | I | |||
2 | dept | name | count | cases | ||
3 | finance | abc | 2 | 2, 32 | ||
4 | finance | def | 1 | 32 | ||
5 | finance | efg | 1 | 11 | ||
6 | hr | bcd | 1 | 8 | ||
7 | hr | no name | 2 | 55, 60 | ||
8 | procurement | cde | 1 | 76 | ||
9 | procurement | no name | 1 | 46 | ||
10 | sales | abc | 1 | 93 | ||
11 | sales | def | 1 | 45a | ||
12 | security | mno | 1 | 37 | ||
filter |
Dynamic array formula used:
excel problems.xlsx | ||||||
---|---|---|---|---|---|---|
K | L | M | N | |||
2 | name | dept | cases | count | ||
3 | abc | finance, sales | 2, 32, 93 | 3 | ||
4 | def | finance, sales | 32, 45a | 2 | ||
5 | efg | finance | 11 | 1 | ||
6 | bcd | hr | 8 | 1 | ||
7 | hr, procurement | 60, 55, 46 | #CALC! | |||
8 | cde | procurement | 76 | 1 | ||
9 | mno | security | 37 | 1 | ||
filter |
Cell Formulas | ||
---|---|---|
Range | Formula | |
K2:N9 | K2 | =LET( all, $B$3:$D$20, name, $B$3:$B$20, dept, $C$3:$C$20, case, $D$3:$D$20, uName, UNIQUE(name&""), nDept, MAP(uName, LAMBDA(x, TEXTJOIN(", ",,UNIQUE(FILTER(dept,name=x))))), caseName, MAP(uName, LAMBDA(x, TEXTJOIN(", ", ,UNIQUE(FILTER(case, name=x))))), cCount, MAP(uName, LAMBDA(x, ROWS(FILTER(case, (name=x)*(name<>""))))), heading, HSTACK({"name"}, {"dept"}, {"cases"}, {"count"}), output, VSTACK(heading, HSTACK(uName, nDept, caseName,cCount)), output) |
Dynamic array formulas. |
Calculation when 'no name' inserted for blank names:
excel problems.xlsx | ||||||
---|---|---|---|---|---|---|
K | L | M | N | |||
2 | name | dept | cases | count | ||
3 | abc | finance, sales | 2, 32, 93 | 3 | ||
4 | def | finance, sales | 32, 45a | 2 | ||
5 | efg | finance | 11 | 1 | ||
6 | bcd | hr | 8 | 1 | ||
7 | no name | #CALC! | #CALC! | #CALC! | ||
8 | cde | procurement | 76 | 1 | ||
9 | mno | security | 37 | 1 | ||
filter |
Cell Formulas | ||
---|---|---|
Range | Formula | |
K2:N9 | K2 | =LET( all, $B$3:$D$20, name, $B$3:$B$20, dept, $C$3:$C$20, case, $D$3:$D$20, uName, IF(UNIQUE(name)="", "no name",UNIQUE(name)), nDept, MAP(uName, LAMBDA(x, TEXTJOIN(", ",,UNIQUE(FILTER(dept,name=x))))), caseName, MAP(uName, LAMBDA(x, TEXTJOIN(", ", ,UNIQUE(FILTER(case, name=x))))), cCount, MAP(uName, LAMBDA(x, ROWS(FILTER(case, (name=x)*(name<>""))))), heading, HSTACK({"name"}, {"dept"}, {"cases"}, {"count"}), output, VSTACK(heading, HSTACK(uName, nDept, caseName,cCount)), output) |
Dynamic array formulas. |