Daniel Shanahan Posted January 8, 2001 Posted January 8, 2001 I have an one address field that sometimes contains more than one line. instead of wrapping it, there is a carriage return. for instance: Bailey Building and Loan 1234 Main St. The problem is, when we send out our newsletter, the company who mails it requires the address info be sent to them in an Excel file. Once i export this information, i loose the carriage return and everything is on one line, and often times that line is too long and some of the information does not show. Is there a script I can write to find a carriage return in the address field and cut and paste that second line into a newly created field called Address 2?
BobWeaver Posted January 8, 2001 Posted January 8, 2001 You can make 3 calculated fields as follows: CR=Position(Address,"
Daniel Shanahan Posted January 21, 2001 Author Posted January 21, 2001 thanks, bob. the scripts work well. can you explain them to me? i understand the CR script... but not so much the Address1 and Address2. Is there a reason you used the "IF" formula rather than a "CHOOSE" formula? dan shanahan
BobWeaver Posted January 22, 2001 Posted January 22, 2001 The way I wrote the If() statement is perhaps a bit confusing. If the first item in the If() statement evaluates to any non-zero value (true), then the second item is returned as the value of the function. If the first item evaluates to zero (false), then the 3rd item is returned as the value of the function. From the Position() function, CR will be 0 (false) if there is no carriage return. Otherwise, it will equal the position of the carriage return (true). So, I could have written the If() statement as either: If(CR,... or as: If(CR>0,... It is functionally the same thing in this case. When a carriage return is found, AddressLine1 will contain only the text up to the carriage return, and AddressLine2 will contain the text after the carriage return. If there is no carriage return, then AddressLine1 will contain ALL the text, and AddressLine2 will be empty. You could also use the Choose() or the Case() function to do the same thing. What I showed is just personal preference. We tend to use what we are familiar with.
Recommended Posts
This topic is 8711 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