Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel formula to copy/paste formula needed please. | Excel Discussion (Misc queries) | |||
Excel 2002 Formula: Urgent Conditional Formula Required Right Away - if possible | Excel Discussion (Misc queries) | |||
Build excel formula using field values as text in the formula | Excel Worksheet Functions | |||
Excel 2002 formula displayed not value formula option not checked | Excel Worksheet Functions | |||
How do I view formula results intead of formula in excel? | Excel Worksheet Functions |