Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default using a formula in a program

I'm trying to write a program which will use the formula
("=SUMIF(AA8:AA208,3,C8:C208)" in a loop, except that I'd like to change the
integer "3" in the formula to a variable so that I can increase this value
each time through the loop.

The program works as long as I leave the value an integer "3". "4", etc. But
I can't make it work with a variable.

Can someone give me a boost that might help me with this problem?

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default using a formula in a program

Posting your code would have been helpful. Assuming your variable's name is
MyVar, I think this is what you are looking for..

MyVar = 4
<whatever you are assigning to = "=SUMIF(AA8:AA208," & MyVar & ",C8:C208"

Rick


"Ed" wrote in message
...
I'm trying to write a program which will use the formula
("=SUMIF(AA8:AA208,3,C8:C208)" in a loop, except that I'd like to change
the integer "3" in the formula to a variable so that I can increase this
value each time through the loop.

The program works as long as I leave the value an integer "3". "4", etc.
But I can't make it work with a variable.

Can someone give me a boost that might help me with this problem?

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default using a formula in a program


Thanks very much Rick. I'll give it a try.


"Rick Rothstein (MVP - VB)" wrote in
message ...
Posting your code would have been helpful. Assuming your variable's name
is MyVar, I think this is what you are looking for..

MyVar = 4
<whatever you are assigning to = "=SUMIF(AA8:AA208," & MyVar & ",C8:C208"

Rick


"Ed" wrote in message
...
I'm trying to write a program which will use the formula
("=SUMIF(AA8:AA208,3,C8:C208)" in a loop, except that I'd like to change
the integer "3" in the formula to a variable so that I can increase this
value each time through the loop.

The program works as long as I leave the value an integer "3". "4", etc.
But I can't make it work with a variable.

Can someone give me a boost that might help me with this problem?

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default using a formula in a program

Try this:

"=SUMIF(AA8:AA208," & variable & ",C8:C208)"

HTH,
Matthew Pfluger

"Ed" wrote:

I'm trying to write a program which will use the formula
("=SUMIF(AA8:AA208,3,C8:C208)" in a loop, except that I'd like to change the
integer "3" in the formula to a variable so that I can increase this value
each time through the loop.

The program works as long as I leave the value an integer "3". "4", etc. But
I can't make it work with a variable.

Can someone give me a boost that might help me with this problem?

Thanks



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
how do i put a formula in a macro to run a program holy41 Excel Worksheet Functions 1 July 8th 06 02:34 AM
My excel program will not let me edit in the formula bar. Editing Excel Discussion (Misc queries) 2 December 13th 05 03:11 AM
Program to make cell a formula Craig Excel Programming 4 September 29th 05 03:01 PM
Program formula Add On Sean Excel Programming 1 May 3rd 05 12:13 PM
Updating the formula by program sameerce[_13_] Excel Programming 7 May 27th 04 07:32 PM


All times are GMT +1. The time now is 10:24 AM.

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

About Us

"It's about Microsoft Excel"