#### apwdweb

##### Board Regular
Hi,

Quick question...

i have two rows. F and H. F contains a series of random numbers. In cell H15 i will need to place the sum of the random numbers from F. However the tricky part is that the number of rows included in this sum is dictated by an integer variable I.

so for example

i = 5
means go to H15 will get the sum of F15 thru F20(count back i number of spaces).

Can some of the experts please help me figure out the other half of this equation to do this:

H15 = ?

Thank you.

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

##### MrExcel MVP
You are hard to follow: You have random numbers in F2:F20 and you have some cel which houses 5 (your 'integer variable' i). In H15, you want to sum the random numbers Fx:F20 which houses 5 of them. Right?

#### apwdweb

##### Board Regular

Close, what i'm looking to do is start at F15 and count up a variable (i) number of cells. so F15 - Fxx where Fxx minus F15 will equal i.

Please post if you need me to clarify more.

##### MrExcel MVP
apwdweb said:
...
Close, what i'm looking to do is start at F15 and count up a variable (i) number of cells. so F15 - Fxx where Fxx minus F15 will equal i...

Your question appears to be: Sum last i (where i=5) cells. What is the range of these random numbers? The last cell seems to be F15. What is the start cell of the range?

#### apwdweb

##### Board Regular

I typed wrong let me try once again...

Active Cell = H15
H15 = Sum of F15 to Fxx (Fxx must be greater than F15 so i'm actually counting DOWN the rows. Sorry i mistyped earlier and put UPWARDS but anyhow it should be counting down rows)

the variable i have created as an integer, i, holds the number of cells i should count down.

So the sum could be:
F15 to F20 where I is 5
or
F15 to F32 where I is 17
of even
F15 to F1500 where I is 1485

thanks

##### MrExcel MVP
apwdweb said:
I typed wrong let me try once again...

Active Cell = H15
H15 = Sum of F15 to Fxx (Fxx must be greater than F15 so i'm actually counting DOWN the rows. Sorry i mistyped earlier and put UPWARDS but anyhow it should be counting down rows)

the variable i have created as an integer, i, holds the number of cells i should count down.

So the sum could be:
F15 to F20 where I is 5
or
F15 to F32 where I is 17
of even
F15 to F1500 where I is 1485

thanks

Why don't you just state what the current range is?

#### apwdweb

##### Board Regular

Hi,

Please bear with me as I'm rather new to VB. i've tried making the correct syntax but have been rather unsuccessful.

Can you please teach me what the code would look like using the variables I stated above?

Thanks

##### MrExcel MVP
apwdweb said:
Hi,

Please bear with me as I'm rather new to VB. i've tried making the correct syntax but have been rather unsuccessful.

Can you please teach me what the code would look like using the variables I stated above?

Thanks

I thought you would accept a formula solution. I should have known better with that "integer variable I". You want VBA, so this will be for someone else. However, I'm amazed I couldn't get your current range.

#### apwdweb

##### Board Regular
Thanks for your help anyway. If anyone out there knows how to do this in VB Please do reply an answer as i could really use the help.

Thanks

Replies
20
Views
329
Replies
4
Views
234
Replies
0
Views
236
Replies
3
Views
385
Replies
8
Views
179

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,152,164
Messages
5,768,564
Members
425,482
Latest member
blazingdiva1

### 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.

### Which adblocker are you using?

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

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