Forum Discussion

Linda Rose's avatar
Linda Rose
Copper Contributor
Nov 17, 2018

IF Statement with multiple answers

4this cell to print
4and this cell as well
4and this cell as well

HI guys, I thought I had IF statements down, but this one is not working for me.  What I am trying to do in one cell [where the answer needs to go]is look at these three cells and if the cell on the left =4 then print what is in the cell next to it.  So three statements in one, with all three answers printing if they are all 4,  if not then it returns nothing for that cell.  It only pulls the first one using this formula:

"=IF(a1=4,b1,if(a2=4,b2,IF(a3=4,b3,"")))"   I need it to pull all three b1,b2,b3 because they all equal 4.

8 Replies

  • dattasmile's avatar
    dattasmile
    Copper Contributor
    please use & sign between each arguments like: "=IF(a1=4,b1&if(a2=4,b2&IF(a3=4,b3,"")))
    result will be all four answers in single cell----------------dattasmile
  • SergeiBaklan's avatar
    SergeiBaklan
    Diamond Contributor

    Hi Linda,

     

    Could you please attach small sample file with your data and desired calculations return, where and what it shall be (without any formulas)

    • Linda Rose's avatar
      Linda Rose
      Copper Contributor

      sorry I wasn't sure where i needed to reply, so reply here as well.

      My issue is that my IF statement is only picking up the first answer, but I need to have it pick up multiple answers. In this case both that are highlighted in yellow, per the IF statement written.  You will see what I am doing when you look at the formula.

       

      • SergeiBaklan's avatar
        SergeiBaklan
        Diamond Contributor

        Hi Linda,

         

        Thank you for the file. Formula could be

        =INDEX($G$14:$G$17,MATCH(1,$B$14:$B$17,0)) & " " &
          INDEX($G$20:$G$23,MATCH(1,$B$20:$B$23,0)) & " " &
          INDEX($G$8:$G$11,MATCH(1,$B$8:$B$11,0))

        it's in D24 of the attached file. No error handling assuming you always 1, but that easily could be added.

        More important assumption you have only one 1 in each block of B cells, otherwise formula doesn't work and we need another one.

Resources