JOY
JOY

Reputation: 389

Cannot use nested IF for CONCATENATE function

I have a column of data and need to use CONCATENATE to combine them as a string.

=CONCATENATE("{",char(34),0,char(34),":",B2,char(34),
IF(A3="Yes",CONCATENATE(",",char(34),1,char(34),":",B3),
IF(A4="Yes",CONCATENATE(",",char(34),2,char(34),":",B4),
IF(A5="Yes",CONCATENATE(",",char(34),1,char(34),":",B5),
IF(A6="Yes",CONCATENATE(",",char(34),1,char(34),":",B6))))),"}")

However, it only combines the first 2 data. Please help.

Demo sheet: https://docs.google.com/spreadsheets/d/1-xZr2SC2t2E5QKtmTD1kQFr-K8GgJjIHL83Wqr6xYF8/edit#gid=0

Upvotes: 0

Views: 110

Answers (1)

MattKing
MattKing

Reputation: 7773

Try this:

="{"&JOIN(",",FILTER(CHAR(34)&SEQUENCE(5,1,0)&CHAR(34)&":"&B2:B6,A2:A6="Yes"))&"}"

Upvotes: 2

Related Questions