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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
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,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

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