Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

array formula question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gary Keramidas - 14 Apr 2008 22:56 GMT
i have an array formula that i'd like to evaluate in code and store it in a
variable instead of creating the array formula.

is it possible?

here is what the formula would look like if i wrote it to a cell:

range("A1").formulaarray = "=SUM(G" & iRow & ":I" & iRow &
")/TRANSPOSE($M$2:$M$4)*O" & iRow

i need to loop through some cells and total all of them, that's why i'd like to
store it in a variable.
Signature


Gary

Dave Peterson - 14 Apr 2008 23:40 GMT
Untested, uncompiled.

dim myVal as double
dim myFormula as string
dim iRow as long

for irow = 1 to 9
 myformula = "SUM(G" & iRow & ":I" & iRow & ")/TRANSPOSE($M$2:$M$4)*O" & iRow
 myval = activesheet.evaluate(myformula)
 'do something with myval
next irow

> i have an array formula that i'd like to evaluate in code and store it in a
> variable instead of creating the array formula.
[quoted text clipped - 11 lines]
>
> Gary

Signature

Dave Peterson

Gary Keramidas - 15 Apr 2008 02:49 GMT
didn't seem to work, dave. i have some code that loops through the range and
gives me the result i need. i was wondering about a formula.

thanks

Signature

Gary

> Untested, uncompiled.
>
[quoted text clipped - 24 lines]
>>
>> Gary
Dave Peterson - 15 Apr 2008 02:54 GMT
Does the formula work when you type it into a cell?

If yes, share that formula that worked.

> didn't seem to work, dave. i have some code that loops through the range and
> gives me the result i need. i was wondering about a formula.
[quoted text clipped - 37 lines]
> >
> > Dave Peterson

Signature

Dave Peterson

Gary Keramidas - 15 Apr 2008 03:38 GMT
here's a similar formula that sort of works. i explain it in a separate post
because i was just looking for a formula, not a value to store in a variable.

=(SUM((1-TRANSPOSE(H2:H4))*G22:I22)+SUM(G22:I22))/TRANSPOSE($M$2:$M$4)

Signature

Gary

> Does the formula work when you type it into a cell?
>
[quoted text clipped - 44 lines]
>> >
>> > Dave Peterson
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.