• 411K Members
• 7,905 Online
• 466K Conversations

## Auto Fill using a formula

Occasional Visitor

# Auto Fill using a formula

I am looking for a function that would allow me to auto fill  a certain number of rows based on data entered in the first row.

So, say I want to fill 20 rows, I'd want the function to automatically fill them in when I fill in the first cell.

Is there a function that can do this?

It was suggested that I use the IF function to generate the needed number of rows, but I don't see how this would work.

Can someone explain or give another idea?

3 Replies

# Re: Auto Fill using a formula

Hello there. You could use an IF formula. The solution there being you can set the false condition to equal a null string ("") which looks blank. To Excel there is a value in there, it's a zero length string, which can be confusing at first. There are inherent problems with that, however. First, since Excel see's it as having data (assuming the cells are blank), it will still print that range, because Excel thinks it has data - which it does, it's just an empty string, but it's a value nonetheless. Second, if your formula never meets the false condition, how are you to know you copied down the formula far enough? This regularly gets users as many data sets you don't know how long it will go down and often the solution is "copy it down really, really, really far *just in case* you need that many rows". As you could imagine this has some caveats.

The best case scenario is for you to define your data set, how and why it will do what it will do, and what the end goal is for it. I'm not sure what a solution would be because you haven't defined it very well at the moment but I can tell you it wouldn't be copying down an IF formula. Define your data more for us and we'll help you get a solution.

# Re: Auto Fill using a formula

In simple variant

in C4

`=IF(ROW()-ROW(StartCell) <=CellsToFill, StartCell, "")`

and drag it down with some gap against your possible range

# Re: Auto Fill using a formula

Depending on the OP's actual needs, this is inherently bad practices, for the reasons I specified above. Also, when using named ranges in your formulas in lieu of absolute cell referencing, it's probably best to qualify them.

Kind regards
Related Conversations
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies