View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
mary s
 
Posts: n/a
Default Custom function in VBE

The "numbers" aren't really numbers. They actually represent different data
labels. I wanted to have a basic formula that I could use to apply to a
number of different situations.

"Ardus Petus" wrote:

Function Status(rCell as Range) as String
Select Case rCell.Value
case 2 to 4 : Status = "Active"
case 5 to 8 : Status = "Inactive"
case 9 to 11 : Status = "Future"
case else: Status = "Unknown"
End Select
End Sub

HTH
--
AP

"mary s" a écrit dans le message de news:
...
I'm trying to write a custom function in VBE to determine if my data falls
into one of three categories, active, inactive, or future, for functions
that
I use all the time in multiple workbooks. The HELP in Excel isn't much
help
for something so complex.

Here is a stripped down example of my function:
=IF(OR(D2="2",D2="3",D2="4"),"Active",IF(OR(D2="5" ,D2="6"DK2="7",D2="8"),"Inactive",IF(OR(D2="9",D2= "10",D2="11"),"Future")))

Any tips on how to get started are much appreciated!