May 23, 200223 yr 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!
May 23, 200223 yr 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
Create an account or sign in to comment