Search code examples
if-statementjoingoogle-sheetsfiltertextjoin

Google Spreadsheet Conditionally Join


I have spreadsheet with two columns.

|---|---------|
| 1 | 2382207 |
| 1 | 2382177 |
| 2 | 2382195 |
| 2 | 2382174 |
| 2 | 2382175 |
| 2 | 2382193 |

I want to join the contents of the second column together, with a | as the separator. I do with using =JOIN("|",B1:B6)

But now what I want is to only include those where the first column = 1. How could I do this conditionally join?

So the outcome that I want is 2382207|2382177


Solution

  • you may use FILTER, =JOIN("|",FILTER(B1:B6;A1:A6=1))