Forum Discussion
IF Statement with multiple answers
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)
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.
- SergeiBaklanNov 17, 2018Diamond 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.
- Linda RoseNov 17, 2018Copper Contributor
I actually see that you used a range in column B. I actually need it to be just one line, as each line has a different response that goes into a different location on the form. How would this look like based upon how I did the IF statements?
- SergeiBaklanNov 17, 2018Diamond Contributor
I see. And how do you define which lines to pickup? In your formula
=IF(B8=1,G8,IF(B14=1,G14,IF(B23=1,G23,"Nothing noted in this section")))
that is first line in first and second groups (B1, B14) and the last line in the third groups (G23). You'd like to combine positions manually, or we take all first positions where 1, into another cell all second positions with 1, etc.
If manually that could be
=IF( (B8=1)+(B14=1)+(B23=1), IF(B8=1,G8 & " ", "") & IF(B14=1,G14 & " ","") & IF(B23=1,G23, ""),"Nothing noted in this section")
and in cell D25 attached