Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
variables in formulas
I'm trying to put in formulas for a row of cells. The row location is
a variable. The formula is an average of a variable number of rows above it. So, there are variables within the formula. After setting the formula for the first column, I just want to fill right with that formula, so the appropriate column is filled. The problem is that this command does not seem to put cell references for StartCell and EndCell. Dim RL, C, R, RLAST As Integer Dim StartCell As Range Dim EndCell As Range ActiveSheet.Range("c" & R).Formula = "=if(ISERROR(AVERAGE(StartCell,EndCell)),"""",AVER AGE(StartCell,EndCell))" Also tried using ActiveSheet.Range("C" & R).FormulaR1C1 but couldn't figure out if that it really the way to go. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
variables in formulas
ActiveSheet.Range("c" & R).Formula = _
"=if(ISERROR(AVERAGE(" & _ StartCell.Address & ":" & EndCell.Address & ")),"""",AVERAGE(" & _ StartCell.Address & ":" & EndCell.Address & "))" -- Regards, Tom Ogilvy wrote in message ups.com... I'm trying to put in formulas for a row of cells. The row location is a variable. The formula is an average of a variable number of rows above it. So, there are variables within the formula. After setting the formula for the first column, I just want to fill right with that formula, so the appropriate column is filled. The problem is that this command does not seem to put cell references for StartCell and EndCell. Dim RL, C, R, RLAST As Integer Dim StartCell As Range Dim EndCell As Range ActiveSheet.Range("c" & R).Formula = "=if(ISERROR(AVERAGE(StartCell,EndCell)),"""",AVER AGE(StartCell,EndCell))" Also tried using ActiveSheet.Range("C" & R).FormulaR1C1 but couldn't figure out if that it really the way to go. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
variables in formulas
On Feb 14, 8:35 pm, "Tom Ogilvy" wrote:
ActiveSheet.Range("c" & R).Formula = _ "=if(ISERROR(AVERAGE(" & _ StartCell.Address & ":" & EndCell.Address & ")),"""",AVERAGE(" & _ StartCell.Address & ":" & EndCell.Address & "))" -- Regards, Tom Ogilvy wrote in message ups.com... I'm trying to put in formulas for a row of cells. The row location is a variable. The formula is an average of a variable number of rows above it. So, there are variables within the formula. After setting the formula for the first column, I just want to fill right with that formula, so the appropriate column is filled. The problem is that this command does not seem to put cell references for StartCell and EndCell. Dim RL, C, R, RLAST As Integer Dim StartCell As Range Dim EndCell As Range ActiveSheet.Range("c" & R).Formula = "=if(ISERROR(AVERAGE(StartCell,EndCell)),"""",AVER AGE(StartCell,EndCell))" Also tried using ActiveSheet.Range("C" & R).FormulaR1C1 but couldn't figure out if that it really the way to go. Thank you so much Tom! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Temp variables within formulas? | Excel Discussion (Misc queries) | |||
Variables in formulas | Excel Worksheet Functions | |||
What if < with multiple variables and formulas | Excel Discussion (Misc queries) | |||
Integrating variables in formulas in VB??? | Excel Programming | |||
How can I use variables in formulas in VB? | Excel Discussion (Misc queries) |