Skip to main content

Hello,

 

 

I am attempting to create a formula that would assign a contact a category based on that contact's current age. I work at a social services agency where we provide services for youth in state custody. Depending on the child's age, they have different schedules for going to the doctor. I want to create a formula that would categorize them so that it would be easy for our case workers to quickly see what schedule their clients are on.

 

 

Basically, if a youth is 1 year or less in age, they are in infancy and must go every month to the doctor. If the youth is between 1 year and 4 years, they are in early childhood and go less often. And on and on.

 

 

We have a formula field that calculates current age. I was trying to use a Case formula where I put Case(Current_Age__c, <= 1, "Infancy", etc, but I am unsure how to proceed with the age ranges. I want to put greater than 1 but less than or equal to 4. But if I put:

 

 

> 1 && <=4, "Early Childhood"

 

 

I get an error message. Is there any way to do this in a formula? Any ideas?

 

 

Thanks!
4 Antworten
  1. 25. Okt. 2013, 18:50
    CASE forces you to use equals, you can't use greater than/less than.  You will need to use nested IF statements to do age ranges.  Something like this:

     

    IF(Current_Age__c <= 1, "Infancy",

     

    IF(Current_Age__c <= 4, "Early Childhood",

     

    IF(Current_Age__c <= 8, "next higher category",

     

    IF(Current_Age__c <= 16, "even higher category",

     

    null

     

    )

     

    )

     

    )

     

    )
0/9000