Using offset to copy formula down a column

Awsib

New Member
Joined
Jan 6, 2020
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi

I am trying to apply a formula where I need to refer to a few cells to the left of the formula cell and a few cells to the up and apply the formula down the column for quite a few rows.

I am trying to achieve the result by using offset function, but I am not getting the desired result.

I would be really grateful of any guidance.

VBA Code:
Sub ResultAchievedIsNotAsRequired()

Dim variableA As Long

variableA = Worksheets("DATA").Range("D7").Value

Dim LeftRow As Long

LeftRow = ActiveCell.Offset(0, -1).Value

Dim Upperrow As Long

Upperrow = ActiveCell.Offset(-1, 0).Value

Dim q As Long

Worksheet("MyCalculation").Range("B2").Select

For q = 5 To 10

Selection.Value = (ActiveCell.Offset(0, -1).Value * (2 / (VariableA + 1)) + ActiveCell.Offset(-1, 0).Value * (1 - (2 / (VariableA + 1))))

ActiveCell.Offset(1, 0).Activate

Next

End Sub

A somewhat similar formula may help in understanding my query better:-
Book1
EFGHI
9445.643,198,600445.64
10443.052,860,400443.05
11452.212,590,300452.21
12453.732,389,800453.73
13451.142,342,000451.14
14450.362,110,900450.36442.82
15457.102,543,100457.1444.86
16456.611,742,000456.61446.54
17453.941,712,500453.94447.60
18458.582,341,400458.58449.17
19462.281,995,200462.28451.04
20460.001,675,100460452.32
21444.892,620,200444.89451.26
22445.282,351,100445.28450.40
23443.972,255,000443.97449.48
24460.413,998,900460.41451.05
25465.243,560,500465.24453.07
26468.732,453,400468.73455.31
27471.372,341,000471.37457.60
MACD
Cell Formulas
RangeFormula
I14I14=SUM(E2:E14)/13
I15:I27I15=(E15*J$3)+(I14*(1-J$3))
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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