Autofill cells down based on another cell

baindes

Board Regular
Joined
Dec 5, 2005
Messages
183
Hello,

I have in cell A1 the number 5, in cell B1 I have 58. In cell C1 I need to have the number 5 from A1 autofill down 58 times based on the number in B1. Is this possible?

Thank you,
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Put in C1 and copy down however far you'd need to overshoot to be sure you'd cover the highest possible value for B1.

=IF(ROW()<=$B$1,$A$1,"")
 
Upvote 0
Hi Greg,

This seems to work however it gives me 1 row shy of what is in B2. For example if I have 58 in b2 in gives me 57 back in Col C.

Thank you.
 
Upvote 0
In your original post B2 was not involved. When did he suddenly show up to the party? Per your original post, the values shown in column C are based on the value in A1 only; and the # of times the value in A1 gets displayed in column C is driven by the value in B1.
 
Upvote 0
Hi,

Oh yes I see what you are saying. I added a header row and when I start in row 2 it counts 1 less vs in Row 1. I there a way to start in row 2 with row 1 having headings so I get an accurate count or do I need to be in row 1.

Thank you~
 
Upvote 0
Ah. Certainly you can leave a top row of headers. I'm assuming the formula now looks like this:

=IF(ROW()<=$B$2,$A$2,"")

Should that be correct, then you need to make an edit to the first part of the formula, which I have bolded and put in red. Let me ask you - what do you think you need to do to fix the formula?


=IF(ROW()<=$B$2,$A$2,"")
 
Upvote 0
Thank you, it does work. I guess I thought i needed to start in row one. I re-entered the formula and that seemed to fix it. Thanks again!
 
Upvote 0
:huh: If you have that formula in C2:C___ then it should not be working completely. You should need to edit it. If you put a 2 in cell B2, how many rows get filled? You should only get one row filled, not two.
 
Upvote 0
Your original formula works just fine. It works excellent, doing just what I needed. Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,310
Members
452,906
Latest member
phanmemchatdakenhupviral

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top