How to conditionally concatenate texts in LibreOffice?
Conditional concatenate can be useful for example if you want to construct one command line from selected rows.
For sums, there is SUMIF
, but not for strings.
However, there is a solution with an intermediate step: Use a separate column for the evaluated condition. Afterwards, the range of the "conditioned text" can be concatenated.
Example
Concatenate text separated by space where the condition is 1.
Text | Condition | Conditioned Text | Formula |
---|---|---|---|
A | 1 | A | =IF(B2=1;A2&" ";"") |
B | =IF(B3=1;A3&" ";"") | ||
C | 1 | C | =IF(B4=1;A4&" ";"") |
D | =IF(B5=1;A5&" ";"") | ||
Conditional concatenated text | A C | =CONCAT(C2:C4) |