Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default excel formula and vba

I have this formula in cell:
=SUM(C12:L12)/((COUNTIF(C12:L12,"=0"))*24)

I need to be able to "convert" this to vba code.
??
thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default excel formula and vba

one way :

Dim dblAnswer As Double
With WorksheetFunction
dblAnswer = .Sum(Range("C12:L12")) / (.CountIf(Range("C12:L12"), "=0")
* 24)
End With


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

I have this formula in cell:
=SUM(C12:L12)/((COUNTIF(C12:L12,"=0"))*24)

I need to be able to "convert" this to vba code.
??
thanks!!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default excel formula and vba

thank you Vergel. I think we are very close. This actually works but I
would like the formula in the cell instead of the value

-m

"Vergel Adriano" wrote:

one way :

Dim dblAnswer As Double
With WorksheetFunction
dblAnswer = .Sum(Range("C12:L12")) / (.CountIf(Range("C12:L12"), "=0")
* 24)
End With


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

I have this formula in cell:
=SUM(C12:L12)/((COUNTIF(C12:L12,"=0"))*24)

I need to be able to "convert" this to vba code.
??
thanks!!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default excel formula and vba

To put the formula in a cell, A1 for example:

Activesheet.Range("A1").Formula =
"=SUM(C12:L12)/((COUNTIF(C12:L12,""=0""))*24)"


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

thank you Vergel. I think we are very close. This actually works but I
would like the formula in the cell instead of the value

-m

"Vergel Adriano" wrote:

one way :

Dim dblAnswer As Double
With WorksheetFunction
dblAnswer = .Sum(Range("C12:L12")) / (.CountIf(Range("C12:L12"), "=0")
* 24)
End With


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

I have this formula in cell:
=SUM(C12:L12)/((COUNTIF(C12:L12,"=0"))*24)

I need to be able to "convert" this to vba code.
??
thanks!!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default excel formula and vba

The double quotes ""="" was messing me up. Thank you, this answered my
question!!

"Vergel Adriano" wrote:

To put the formula in a cell, A1 for example:

Activesheet.Range("A1").Formula =
"=SUM(C12:L12)/((COUNTIF(C12:L12,""=0""))*24)"


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

thank you Vergel. I think we are very close. This actually works but I
would like the formula in the cell instead of the value

-m

"Vergel Adriano" wrote:

one way :

Dim dblAnswer As Double
With WorksheetFunction
dblAnswer = .Sum(Range("C12:L12")) / (.CountIf(Range("C12:L12"), "=0")
* 24)
End With


--
Hope that helps.

Vergel Adriano


"Mona" wrote:

I have this formula in cell:
=SUM(C12:L12)/((COUNTIF(C12:L12,"=0"))*24)

I need to be able to "convert" this to vba code.
??
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
Excel formula to copy/paste formula needed please. colwyn Excel Discussion (Misc queries) 4 October 22nd 08 11:27 PM
Excel 2002 Formula: Urgent Conditional Formula Required Right Away - if possible blue[_2_] Excel Discussion (Misc queries) 2 July 11th 07 06:08 PM
Build excel formula using field values as text in the formula val kilbane Excel Worksheet Functions 2 April 18th 07 01:52 PM
Excel 2002 formula displayed not value formula option not checked Dean Excel Worksheet Functions 1 February 28th 06 02:31 PM
How do I view formula results intead of formula in excel? davidinatlanta Excel Worksheet Functions 4 February 7th 06 03:02 PM


All times are GMT +1. The time now is 01:00 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"