Hi,
I have two tables, A and B. Table A is countries planned and Table B is planed driven KM.
I also have a summary where I want to see total planed KM, per country, and what calendar weeks that specific country is planed.
I have a formula that summarizes planed driven km in a set of specific countries (B3).
I have a second formula that uses TEXTJOIN to list the calendar weeks each country is planned (C3).
So far so good. But now comes my issue...
Table A and Table B contains plans for two different purposes, differentiated by different colored cells (manually applied) in both tables. Currently both formulas does a sum total, regardless of color.
For the summary to be useful, it needs to be able to summarize one color at a time, preferably by a referenced cell.
If we take DK for example, and the result I would like to get:
DK: 500 KM (CW14) -- Blue cells
DK: 200 KM (CW12; CW13) -- Green cells
I have tried to look into VBA and a function to sum by color, but how ever I do it I cannot get it to work with the rest of the formula.
Can this be done? with VBA?
Or are they any other smart solutions to this problem?
I have two tables, A and B. Table A is countries planned and Table B is planed driven KM.
I also have a summary where I want to see total planed KM, per country, and what calendar weeks that specific country is planed.
I have a formula that summarizes planed driven km in a set of specific countries (B3).
I have a second formula that uses TEXTJOIN to list the calendar weeks each country is planned (C3).
So far so good. But now comes my issue...
Table A and Table B contains plans for two different purposes, differentiated by different colored cells (manually applied) in both tables. Currently both formulas does a sum total, regardless of color.
For the summary to be useful, it needs to be able to summarize one color at a time, preferably by a referenced cell.
If we take DK for example, and the result I would like to get:
DK: 500 KM (CW14) -- Blue cells
DK: 200 KM (CW12; CW13) -- Green cells
I have tried to look into VBA and a function to sum by color, but how ever I do it I cannot get it to work with the rest of the formula.
Can this be done? with VBA?
Or are they any other smart solutions to this problem?
SampleKMCW.xlsm | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Summary | Table A | CW12 | CW13 | CW14 | CW15 | ||||||
2 | Countries | KM | CW | Car 1 | transport | DK | DK-DE | DE | ||||
3 | SE | 650 | CW12; CW15 | |||||||||
4 | DK | 700 | CW12; CW13; CW14 | Car2 | SE | FI | EE | LV | ||||
5 | FI | 300 | CW13 | |||||||||
6 | DE | 500 | CW12; CW13; CW14; CW15 | Car3 | SE-DK-DE | DE | DK | SE | ||||
7 | LV | 150 | CW15 | |||||||||
8 | EE | 250 | CW14 | Table B | CW12 | CW13 | CW14 | CW15 | ||||
9 | Car 1 | transport | 150 | 200 | 150 | |||||||
10 | ||||||||||||
11 | Car2 | 150 | 300 | 250 | 150 | |||||||
12 | VAL | |||||||||||
13 | DEV | Car3 | 150 | 200 | 400 | 450 | ||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B3:B8 | B3 | =HSTACK(MAP(UNIQUE(TOCOL(TEXTSPLIT(A3:A8,"-"))),LAMBDA(z,SUMPRODUCT(N(ISNUMBER($G$9:$J$13)),$G$9:$J$13,N(ISNUMBER(FIND(z,$G$2:$J$6)))/MAP($G$2:$J$6,LAMBDA(x,COUNTA(TEXTSPLIT(x,"-")))))))) |
C3:C8 | C3 | =IFERROR(MAP(A3:A8,LAMBDA(x,TEXTJOIN("; ",,UNIQUE(TOCOL(IFS(FIND(x,$G$2:$J$6),$G$1:$J$1),3,1))))),"") |
Dynamic array formulas. |