Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
functions & range vars
Greetings:
I'm trying to do something that should be easy but can't find a decent book. I'm using Excell 2000 and want to create a custom sum function that handles more than one conditional. Can't figure out how to get range into the function and use it in the calcs. Mysumif(RngOne as Range) For i = first cell to last cell in range If .... and ... Then sum this cell into total. (like that see?) next i then use it like any function: Mysumif("A1:A50") any suggestions? Thanks, Bob |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
functions & range vars
If I understand you correctly -
[ cells(rw,1) represents each cell in column A] Dim sm as Double, rw as Long sm = 0 For rw = 1 to lastrow If Cells(rw,1) = [ put in your condition ] then sm = sm + Cells(rw,1) Elseif '<<<< use for additonal conditions, add as many as needed... Else End If Next -- steveB Remove "AYN" from email to respond wrote in message oups.com... Greetings: I'm trying to do something that should be easy but can't find a decent book. I'm using Excell 2000 and want to create a custom sum function that handles more than one conditional. Can't figure out how to get range into the function and use it in the calcs. Mysumif(RngOne as Range) For i = first cell to last cell in range If .... and ... Then sum this cell into total. (like that see?) next i then use it like any function: Mysumif("A1:A50") any suggestions? Thanks, Bob |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
functions & range vars
Forgot to mention that it works in a macro.
May not work in a function. -- steveB Remove "AYN" from email to respond wrote in message oups.com... Greetings: I'm trying to do something that should be easy but can't find a decent book. I'm using Excell 2000 and want to create a custom sum function that handles more than one conditional. Can't figure out how to get range into the function and use it in the calcs. Mysumif(RngOne as Range) For i = first cell to last cell in range If .... and ... Then sum this cell into total. (like that see?) next i then use it like any function: Mysumif("A1:A50") any suggestions? Thanks, Bob |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using range names in functions | Excel Worksheet Functions | |||
Worksheet wide vars | Excel Programming | |||
= How to setup vars when a workbookopen event is launched? | Excel Programming | |||
Global vars | Excel Programming | |||
Using Range inputs in functions | Excel Programming |