ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Correlation of Variables (https://www.excelbanter.com/excel-programming/297662-correlation-variables.html)

Newbie

Correlation of Variables
 
i'm tring to take the correlation of two different groups
of cells that i store the addresses of in variables. the
problem is that i need to keep the ranges for an arbitrary
group of cells, which is why i use the variables. here's an
example :

adrs = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

adrs2 = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

Range("A1")Sselect
' this next line is where i have problems with the addresses
ActiveCell.Formula = "=CORREL( adrs, adrs2 )"


any ideas what to put in the CORREL command to get it to
take the correlation of the two groups of cells? thanks

Chip Pearson

Correlation of Variables
 
Try something like

ActiveCell.Formula = "=CORREL(" & adrs & "," & adrs2 & ")"

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"NEWBIE" wrote in message
...
i'm tring to take the correlation of two different groups
of cells that i store the addresses of in variables. the
problem is that i need to keep the ranges for an arbitrary
group of cells, which is why i use the variables. here's an
example :

adrs = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

adrs2 = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

Range("A1")Sselect
' this next line is where i have problems with the addresses
ActiveCell.Formula = "=CORREL( adrs, adrs2 )"


any ideas what to put in the CORREL command to get it to
take the correlation of the two groups of cells? thanks




No Name

Correlation of Variables
 
that's perfect! thanks! one more question, how would i do
this if the cells i selected in the beginning were from
lets say sheet1 and the ActiveCell in this example was on
sheet2? any ideas?


-----Original Message-----
Try something like

ActiveCell.Formula = "=CORREL(" & adrs & "," & adrs2 & ")"

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"NEWBIE" wrote in

message
...
i'm tring to take the correlation of two different groups
of cells that i store the addresses of in variables. the
problem is that i need to keep the ranges for an arbitrary
group of cells, which is why i use the variables. here's an
example :

adrs = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

adrs2 = Range(Sheets("Sheet2").cells(2,col),
Sheets("Sheet2").cells(2,col).end(xlDown)).Address

Range("A1")Sselect
' this next line is where i have problems with the addresses
ActiveCell.Formula = "=CORREL( adrs, adrs2 )"


any ideas what to put in the CORREL command to get it to
take the correlation of the two groups of cells? thanks



.



All times are GMT +1. The time now is 08:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com