I watched a tutorial where the author uses an IF statement along with the ARRAYFORMULA function to add a title row to a column of data. Links are given to the docs; however, for an example of how to use ARRAYFORMULA
see this answer.
An example can be seen below:
I was able to populate the C
column by placing the following formula in C1
:
=ARRAYFORMULA(if(row(A:A) = 1, "spent", B:B - A:A))
I'm confused about the syntax. I understand that X:X
references the entire X
column but I don't understand how it's being used to check if we're at cell A1
in one context and then being used to apply mass formulas in another context.
- How does the above line work?
- Can you illustrate with some examples?