Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Storing formula in cell

I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1 &":R" &R5))"


I've tried using double "s at various places but with no success. The
formula that is saved does not match the one above. Any ideas on what the
right combination of " is for this formula so I can save a copy in a cell?
Thanks.

Jim
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default Storing formula in cell

When you save "save in a cell"... do you mean as text so it doesn't get
evaluated? If yes, just leave it as it is and put an apostrophe in front of
the equal sign.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1 &":R"
&R5))"


I've tried using double "s at various places but with no success. The
formula that is saved does not match the one above. Any ideas on what the
right combination of " is for this formula so I can save a copy in a cell?
Thanks.

Jim


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Storing formula in cell

Rick,

No, I want it to be executable.

Jim

"Rick Rothstein" wrote:

When you save "save in a cell"... do you mean as text so it doesn't get
evaluated? If yes, just leave it as it is and put an apostrophe in front of
the equal sign.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1 &":R"
&R5))"


I've tried using double "s at various places but with no success. The
formula that is saved does not match the one above. Any ideas on what the
right combination of " is for this formula so I can save a copy in a cell?
Thanks.

Jim



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default Storing formula in cell

Your originally posted formula looks like it has an extra quote mark at the
very end... try removing the last character (which is a quote mark) and see
if that does it for you.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
Rick,

No, I want it to be executable.

Jim

"Rick Rothstein" wrote:

When you save "save in a cell"... do you mean as text so it doesn't get
evaluated? If yes, just leave it as it is and put an apostrophe in front
of
the equal sign.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1 &":R"
&R5))"


I've tried using double "s at various places but with no success. The
formula that is saved does not match the one above. Any ideas on what
the
right combination of " is for this formula so I can save a copy in a
cell?
Thanks.

Jim




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default Storing formula in cell

Rick,
Here is a test macro with the formula that I am trying to save in a cell.
The formula needs to be executable in the cell not just a text string. I
can't get it to work - I tried replacing all the quotes in the formula with
double quotes but it still wouldn't work. In this example, I am showing the
actual real formula without any double quotes. Give it a try and see if you
can figure out what needs to be done. Maybe it is too complicated a formula
to save!!

Jim

Sub TestStoreFormula()

' Initialize Night Begin/End Date/Time cells/values

NightStartDateNTime = "=$B$2+$A$1"
Range("$B$1").Select
ActiveCell.Formula = NightStartDateNTime
NightEndDateNTime = "=$B$1+0.99929"
Range("$C$2").Select
ActiveCell.Formula = NightEndDateNTime


' TestStoreFormula Macro
' Macro recorded 7/24/2009

' Need different formula for calculating Leak Hrs for Session Charts than
for Night Charts

SessionLeakHrs = "=SumIf(Indirect("S" &Q5+1 &":S" &R5+1),"<"
&V2,Indirect("R" &Q5+1 &":R" &R5+1))"
Range("$W$2").Select
ActiveCell.Formula = SessionLeakHrs

End Sub

"Rick Rothstein" wrote:

Your originally posted formula looks like it has an extra quote mark at the
very end... try removing the last character (which is a quote mark) and see
if that does it for you.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
Rick,

No, I want it to be executable.

Jim

"Rick Rothstein" wrote:

When you save "save in a cell"... do you mean as text so it doesn't get
evaluated? If yes, just leave it as it is and put an apostrophe in front
of
the equal sign.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1 &":R"
&R5))"


I've tried using double "s at various places but with no success. The
formula that is saved does not match the one above. Any ideas on what
the
right combination of " is for this formula so I can save a copy in a
cell?
Thanks.

Jim






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,934
Default Storing formula in cell

SessionLeakHrs = "=SumIf(Indirect("S" &Q5+1 &":S" &R5+1),"<"
&V2,Indirect("R" &Q5+1 &":R" &R5+1))"


There are a couple of ways to interpret exactly which formula you want from
the above. Given the set up you show in the statement above, can you show us
sample values for Q5, R5 and V5 and then show us the formula you want to end
up in the cell for those given values?

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
Rick,
Here is a test macro with the formula that I am trying to save in a cell.
The formula needs to be executable in the cell not just a text string. I
can't get it to work - I tried replacing all the quotes in the formula
with
double quotes but it still wouldn't work. In this example, I am showing
the
actual real formula without any double quotes. Give it a try and see if
you
can figure out what needs to be done. Maybe it is too complicated a
formula
to save!!

Jim

Sub TestStoreFormula()

' Initialize Night Begin/End Date/Time cells/values

NightStartDateNTime = "=$B$2+$A$1"
Range("$B$1").Select
ActiveCell.Formula = NightStartDateNTime
NightEndDateNTime = "=$B$1+0.99929"
Range("$C$2").Select
ActiveCell.Formula = NightEndDateNTime


' TestStoreFormula Macro
' Macro recorded 7/24/2009

' Need different formula for calculating Leak Hrs for Session Charts than
for Night Charts

SessionLeakHrs = "=SumIf(Indirect("S" &Q5+1 &":S" &R5+1),"<"
&V2,Indirect("R" &Q5+1 &":R" &R5+1))"
Range("$W$2").Select
ActiveCell.Formula = SessionLeakHrs

End Sub

"Rick Rothstein" wrote:

Your originally posted formula looks like it has an extra quote mark at
the
very end... try removing the last character (which is a quote mark) and
see
if that does it for you.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
Rick,

No, I want it to be executable.

Jim

"Rick Rothstein" wrote:

When you save "save in a cell"... do you mean as text so it doesn't
get
evaluated? If yes, just leave it as it is and put an apostrophe in
front
of
the equal sign.

--
Rick (MVP - Excel)


"Cinco" wrote in message
...
I want to save the following formula in a cell:

=Sumif(Indirect("S" &Q5+1 &":S" &R5),"<" &V2,Indirect("R" &Q5+1
&":R"
&R5))"


I've tried using double "s at various places but with no success.
The
formula that is saved does not match the one above. Any ideas on
what
the
right combination of " is for this formula so I can save a copy in a
cell?
Thanks.

Jim





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing an array in a cell Blue Max Excel Worksheet Functions 9 March 18th 09 12:54 PM
Storing a range variable in a cell Dreaded404 Excel Discussion (Misc queries) 1 July 2nd 08 03:37 PM
storing lettrs in an excel cell to later = a number for a formula diydan48 Excel Discussion (Misc queries) 1 October 15th 06 09:16 PM
excel storing previous cell values in memory Brent Bortnick Excel Worksheet Functions 2 April 19th 06 09:00 PM
Storing Formulas to Use NEWB Excel Worksheet Functions 3 December 2nd 05 05:23 PM


All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"