Saturday, August 11, 2012

Interesting Formulas II :

Interesting Formulas II :
This post is continuous to previous formulas post ,please check it  Here.
Timezone :This formula calculate timezone on account

IF(LEN( BillingState)=0, 'None', 
IF(CONTAINS('CT:DC:DE:FL:GA:IN:ME:MD:MA:MI:NH:NJ:NY:NC:OH:PA:RI:SC:VT:VA:WV:ON:QC:NB:NS:NL:PE', BillingState), 'GMT-5 Eastern', 
IF(CONTAINS('AL:AR:IL:IA:KS:KY:LA:MN:MS:MO:NE:ND:OK:SD:TN:TX:WI:SK:MB:NU', BillingState), 'GMT-6 Central', 
IF(CONTAINS('AZ:CO:ID:MT:NM:UT:WY:AB:NT', BillingState), 'GMT-7 Mountain', 
IF(CONTAINS('AK', BillingState), 'GMT-9 Alaska', 
IF(CONTAINS('HI', BillingState), 'GMT-10 Hawaii', 
IF(CONTAINS('CA:NV:OR:WA:BC:YT', BillingState), 'GMT-8 Pacific', 'Other')))))))

State Validation:This is validation on account billing state should be related US if the country is either US or USA.
Don't you think this is one of way you can control your user's mistakes?

AND ( OR(BillingCountry = "US", BillingCountry="USA", 
LEN(BillingCountry)=0), OR( LEN(BillingState) < 2, 
NOT(CONTAINS("AL:AK:AZ:AR:CA:CO:CT:DE:DC:FL:GA:HI:ID:" & 
"IL:IN:IA:KS:KY:LA:ME:MD:MA:MI:MN:MS:MO:MT:NE:NV:NH:" & 
"NJ:NM:NY:NC:ND:OH:OK:OR:PA:RI:SC:SD:TN:TX:UT:VT:VA:" & 
"WA:WV:WI:WY", BillingState) )))

No comments:

Post a Comment