Forum Discussion

mkglen's avatar
mkglen
Copper Contributor
Nov 01, 2023

Problem with IF formula

I am trying to get column S to list pickup days if columns N, O, P, Q, R have a value in them. My formula =IF(N2<>"","M, ",IF(O2<>"","T, ",IF(P2<>"","W, ",IF(Q2<>"","H, ",IF(R2<>"","F, ",""))))) is only returning the first value. Cell S2 should say M, W, and cell S6 should say T, F, for example

 

4 Replies

  • Heather970's avatar
    Heather970
    Copper Contributor

    mkglen I have never seen the IF statement used that way, but here is a solution that nests if statements inside of the CONCAT function. =CONCAT(IF(N2<>"","M, ",""),IF(O2<>"","T, ",""),IF(P2<>"","W, ",""),IF(Q2<>"","TH, ",""),IF(R2<>"","F",""))

     

    • mkglen's avatar
      mkglen
      Copper Contributor
      I am using Excel 2016 so I had to use CONCATENATE but that worked. Thank you!
  • mkglen 

    =BYROW(N2:R6,LAMBDA(x,TEXTJOIN(",",,FILTER(N1:R1,NOT(ISBLANK(x))))))

     

    With Office 365 or Excel for the web you can apply this formula.

    • Heather970's avatar
      Heather970
      Copper Contributor
      For non web or 365 users you could shorten this to
      =TEXTJOIN(", ",,FILTER($N$1:$R$1,NOT(ISBLANK(N2:R2))))

Resources