# Loop or forumla that adds

#### manthony

##### New Member
Hi, my apologies I do not have any code to share, but my problem is I need a loop or a formula that adds +1 from the cell above it and runs as long as a number (from a formula in cell A11).

In cell A11 I have a formula that counts the number of records on a different spreadsheet. In cell B11 I have an account number from a Vlookup. I would like to take the number in B11 and add 1 to it (for example if B11 is 2100 then B12 would be 2101, and B13 would be 2102, etc). I would like for this formula to run as long as the number in cell A11. For example if A11 is 4 and B11 is 2100 then it will add down three more times so B12 is 2101, B13 is 2102, B14 is 2103.

Thank you in advance for the help.

#### Snakehips

##### Well-known Member
manthony,

Try formula in B12 and copy down as far as you may need.

Code:
``  =IF(ROWS(B\$12:B12)<=\$A\$11,\$B\$11+ROWS(B\$12:B12),"")``
Hope that helps.

#### AlphaFrog

##### MrExcel MVP
Another one.

=IF(ROW(\$B\$11)+\$A\$11>ROW(),B11+1,"")

#### NotoriousPopol

##### Board Regular
Something like "=IF(B11-\$B\$11<\$A\$11, B11+1, "")" could do the work! You put this formula in B12 then extend it to the right.

#### Snakehips

##### Well-known Member
Another one.

=IF(ROW(\$B\$11)+\$A\$11>ROW(),B11+1,"")
Should be =IF(ROW(\$B\$11)+\$A\$11>ROW()-1,B11+1,"") ??

#### AlphaFrog

##### MrExcel MVP
Should be =IF(ROW(\$B\$11)+\$A\$11>ROW()-1,B11+1,"") ??
Not a according to the OPs description.

For example if A11 is 4 and B11 is 2100 then it will add down three more times so B12 is 2101, B13 is 2102, B14 is 2103.

Last edited:

#### Snakehips

##### Well-known Member
Not a according to the OPs description.

So my formula would need to be =IF(ROWS(B\$12:B12)<\$A\$11,\$B\$11+ROWS(B\$12:B12),"")

#### manthony

##### New Member
Hi, thank you so much this formula is perfect, exactly what I needed. Thank you 1,081,770
Messages
5,361,181
Members
400,617
Latest member
barron1

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...