Formula continues to count up

Glasgowsmile

Active Member
Joined
Apr 14, 2018
Messages
280
Office Version
  1. 365
Platform
  1. Windows
Good day,

I've got this formula below that I'm having issues with.
VBA Code:
=IF(AND($A50<>"", $A$5>34),$A50+1,"")

Essentially $A$5 starts at >1 in Cell A17 and in Cell A18, I changed it to 2 - it continues like this up to $A$5>34 like you see above but I've had to do that manually because when I tried to drag the pattern down it wouldn't continue to count up. Is there a way to do that? I'm now having to drag this formula down several hundred sells so it would be $A$5>344 but I don't want to have to manually go through and update all of these.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try this in A5:

Excel Formula:
=IF(AND($A50<>"", $A$5>ROWS($A$5:$A5)),$A50+1,"")
 
Upvote 0
Solution
Try this in A5:

Excel Formula:
=IF(AND($A50<>"", $A$5>ROWS($A$5:$A5)),$A50+1,"")
This worked wonderfully if you would - could you explain a little about how it works? I can't quite make sense of it.
 
Upvote 0
Sure. ROWS is a function that just tells you how many rows are in the range. So when you start in the A5 cell, the range is $A$5:$A5, so it has 1 row in it. When you drag the formula down a row, that range changes to $A$5:$A6, since the last row reference doesn't have the $ to make it absolute. The $A$5:$A6 range has 2 rows, so ROWS gives 2 now. As you drag it down, the range gets bigger by 1 row every time.

Hope this helps! ?
 
Upvote 0

Forum statistics

Threads
1,214,818
Messages
6,121,725
Members
449,049
Latest member
MiguekHeka

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