I have to combine 2 columns based on a criteria. At present, I´m able to do this using a simple IF statement. I would like to achieve the same result using dynamic array functions. The dynamic array formula used is returning incorrect results (refer trial table below). I know I would have done a silly mistake. Can the experts in this forum help please?
Problem statement -
In the source table, I have columns cl & ld with x marked in few cells. These 2 columns should be combined to a single column clld-c as shown in the desired output. If any cell in columns cl & ld in the source table contains x, mark x in the column clld-c in the desired output. If there is no x marked, leave it as blank cell. All other columns from source table remains the same.
Source table -
Trial table -
Desired output -
Problem statement -
In the source table, I have columns cl & ld with x marked in few cells. These 2 columns should be combined to a single column clld-c as shown in the desired output. If any cell in columns cl & ld in the source table contains x, mark x in the column clld-c in the desired output. If there is no x marked, leave it as blank cell. All other columns from source table remains the same.
Source table -
excel problems.xlsx | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
B | C | D | E | F | G | H | I | |||
2 | id | name | dept | ttt-clld | cl | ld | ttt-ce | co | ||
3 | 1 | ffty | f | x | x | |||||
4 | 5 | ffdv | h | x | x | |||||
5 | 9 | kgkg | m | x | ||||||
6 | 11 | eqe | t | x | x | x | ||||
7 | 20 | yuio | f | x | ||||||
8 | 39 | lhlg | f | x | x | |||||
9 | 67 | bmvv | m | x | ||||||
10 | 68 | bcv | m | x | ||||||
11 | 85 | ehv | m | x | x | x | ||||
12 | 97 | okg | t | x | x | x | ||||
Sheet4 |
Trial table -
excel problems.xlsx | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
T | U | V | W | X | Y | Z | AA | AB | AC | |||
3 | 1 | ffty | f | x | x | 0 | 0 | 0 | #VALUE! | x | ||
4 | 5 | ffdv | h | 0 | 0 | 0 | x | x | x | x | ||
5 | 9 | kgkg | m | 0 | 0 | x | 0 | 0 | x | #VALUE! | ||
6 | 11 | eqe | t | 0 | x | 0 | x | x | #VALUE! | x | ||
7 | 20 | yuio | f | 0 | 0 | 0 | 0 | x | x | x | ||
8 | 39 | lhlg | f | 0 | x | x | 0 | 0 | #VALUE! | #VALUE! | ||
9 | 67 | bmvv | m | 0 | 0 | x | 0 | 0 | x | #VALUE! | ||
10 | 68 | bcv | m | 0 | 0 | 0 | 0 | x | x | x | ||
11 | 85 | ehv | m | x | x | x | 0 | 0 | #VALUE! | #VALUE! | ||
12 | 97 | okg | t | 0 | 0 | x | x | x | x | #VALUE! | ||
Sheet4 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
T3:AC12 | T3 | =LET( fTable,$B$3:$I$12, fId,$B$3:$B$12,ClLd,$F$3:$G$12, comClLd,MAP(ClLd,LAMBDA(loopId,IF(OR(INDEX(ClLd,loopId,1)="x",INDEX(ClLd,loopId,2)="x"),"x",""))), HSTACK(fTable,comClLd)) |
Dynamic array formulas. |
Desired output -
excel problems.xlsx | |||||||||
---|---|---|---|---|---|---|---|---|---|
L | M | N | O | P | Q | R | |||
2 | id | name | dept | ttt-clld | clld-c | ttt-ce | co | ||
3 | 1 | ffty | f | x | x | ||||
4 | 5 | ffdv | h | x | x | ||||
5 | 9 | kgkg | m | x | |||||
6 | 11 | eqe | t | x | x | x | |||
7 | 20 | yuio | f | x | |||||
8 | 39 | lhlg | f | x | |||||
9 | 67 | bmvv | m | x | |||||
10 | 68 | bcv | m | x | |||||
11 | 85 | ehv | m | x | x | ||||
12 | 97 | okg | t | x | x | x | |||
Sheet4 |