J.P. Posted May 23, 2002 Posted May 23, 2002 Hi, I'm trying to create a automate calculation field that inputs data reflect by other field. Ex: customer field contains word starting from left has "one" then automate field should be marked as "customer one". This is the script that i used and seems like its not working well... If( LeftWords( CUSTOMER, 2 ) = "ae" or "jc" or "ps" or "ta" , "BC" , If( LeftWords( CUSTOMER , 2 )= "ex" or "st" , "LTD" , If( LeftWords( CUSTOMER , 2 ) = "ch" or "ck" , "WAC" , If( LeftWords( CUSTOMER , 2 )= "th", "UAV" , "") ) ) ) I need some help from you experts. Thanks in advance!
andygaunt Posted May 23, 2002 Posted May 23, 2002 Hi, First you are using LeftWords (Customer,2). Leftwords means the first two words from the left as opposed to Left (Customer,2) which is the first two characters. OK. Now, the other problem is you have to tell the calculation not just Left (Customer,2) = "ae" or "jc" as this will only ever account for the first instance. The second item it doesnt know what it is or(ing). So, if we change your calc to Case( Left( Customer, 2 ) = "ae" or Left( Customer, 2 )="jc" or Left( Customer, 2 )="ps" or Left( Customer, 2 ) ="ta" , "BC" , Left( Customer , 2 )= "ex" or Left( Customer, 2 ) = "st" , "LTD" , Left( Customer , 2 ) = "ch" or Left( Customer, 2 )="ck" , "WAC" , Left( Customer , 2 )= "th", "UAV" , "")Then everything is good in the world. Also, you will notice using a case statement is a lot easier than using multiple IFs. A lot easier to read. Anyhow, HTH
Recommended Posts
This topic is 8290 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now