SOLVED

IF statement only filling out first cell

New Contributor

I have a stupid question  so I've been following some tutorials, and one mentions IF statements. I wrote it out exactly the way it was in the tutorial, and am using the very same file that is being presented in the tutorial. However, in the demonstration, it fills out the whole column automatically for him, while it only filled in the first cell for me (first image below). I tried writing the formula with the column selected, no game. I checked 4 times, I definitely wrote it out exactly the way it was in the tutorial.

 

I tried dragging the square on the right down and it kind of worked, but all of the cells then had errors because they were shifting the formula down (instead of D2:10, it was D3:11, D4:12, and so on). Like the second image.

 

Is it just some setting that I have wrong?

 

drag.JPG

ifstatement.JPG

2 Replies
best response confirmed by Sergei Baklan (MVP)
Solution

What version of Excel are you using? The dynamic array functionality you saw and are trying to use was introduce in 2021 I believe so if you have an older version you will need to do the drag down technique. In order to not get erroneous values when you drag down use the$ character to "lock" particular reference parts like: $A2:$A5 will lock column A even if you copy it right or left while A$2:A$5 will lock rows 2-5 even if you copy up or down and $A$2:$A$5 will lock both rows and column.
That said in your formula you just need =IF(D2>30, "Old", "Yound") and drag down.

@mtarler OOH that makes a lot of sense, thank you! I'm at my college's computers and they have 2019, so that makes sense. Thank you so much!