However you don't even need to fill the formula to all cells. Using a multi-result array formula would be better. Just enter the formula like normal but replaces the cells by the range (e.g.
B1:B10000. That's a bit oversimplified but that's the idea, read below for more details) and then press Ctrl+Shift+Enter. The formula will then be applied immediately to all the cells in the table, very few keystrokes needed
Why use array formulas?
If you have experience using formulas in Excel, you know that you can perform some fairly sophisticated operations. For example, you can calculate the total cost of a loan over any given number of years. You can use array formulas to do complex tasks, such as:
- Count the number of characters that are contained in a range of cells.
- Sum only numbers that meet certain conditions, such as the lowest values in a range or numbers that fall between an upper and lower boundary.
- Sum every nth value in a range of values.
Array formulas also offer these advantages:
- Consistency: If you click any of the cells from E2 downward, you see the same formula. That consistency can help ensure greater accuracy.
- Safety: You cannot overwrite a component of a multi-cell array formula. For example, click cell E3 and press Delete. You have to either select the entire range of cells (E2 through E11) and change the formula for the entire array, or leave the array as is. As an added safety measure, you have to press Ctrl+Shift+Enter to confirm the change to the formula.
- Smaller file sizes: You can often use a single array formula instead of several intermediate formulas. For example, the workbook uses one array formula to calculate the results in column E. If you had used standard formulas (such as =C2*D2, C3*D3, C4*D4…), you would have used 11 different formulas to calculate the same results.
Guidelines and examples of array formulas
Array formula is also faster since the access pattern is already known. Now instead of doing 11 different calculations separately, they can be vectorized and done in parallel, utilizing multiple cores and SIMD unit in the CPU
For example if you want cells in column D to contain the product of cells in B and C, and column E contains sum of B and C, instead of using
D1 = B1*C1 and
E1 = B1 + C1 and drag down you just put the below formulas in D1 and E1 respectively and press Ctrl+Shift+Enter
=B:B + C:C
In Google sheet you'll need to use
ARRAYFORMULA function instead of the shortcut like in Excel
=ARRAYFORMULA(B:B + C:C)
After that the formula will be automatically applied to the whole column immediately without dragging anything.
X:X refers to column X. If you want to include only from row 3 to the end use
X3:X. Or if you want to calculate the result for only cells from X3 to X10003 then use
X3:X10003. The same syntax can be used for rows, i.e. 1:1 for row 1. Here is another example from Excel's documentation that calculates the product in each column
Array formula is a very powerful tool. However use it with care. Every time you need to edit it you must not forget to press Ctrl+Shift+Enter
For more information read Create an array formula. See also
If you still really want to use a normal formula then use Ctrl+Enter instead of Ctrl+Shift+Enter. It'll fill the formula to all cells in the selection and change the cell references as necessaryy