Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
There is a database that imports address fields from an excel spreadsheet. I have no control over the database, so I need to fix some import problems in Excel first.<o></o>
<o></o>
The address field can only accept 30 characters including spaces and special characters. But a good few of the addresses in excel are longer. So I need to transport the “offcuts” to address line 2 (and in some rare cases, 3 as well)<o></o>
<o></o>
So let’s say I had the following address in cell A1: “Flat 4A, <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-comffice:smarttags" /><st1:Street w:st="on"><st1:address w:st="on">12 Polkington Crescent</st1:address></st1:Street>, Frisby-on-the-Wreake Melton Mowbray” (68 Characters). <o></o>
<o></o>
Is there a formula in B1 which will test the length of the text field in A1, if over 30 characters, look for the nearest space before character 31 (in this case the space before “Crescent”) And return the part of the address up to that space (“Flat 4A, 12 Polkington”)<o></o>
<o></o>
In cell C1, the same principle – search the remainder of the address (“Crescent, Frisby-on-the-Wreake Melton Mowbray” (45 characters), then test the length of the remaining text field, if over 30 characters, look for the nearest space before character 31 (in this case the space before “Melton”) And return the part of the address up to that space (“Crescent, Frisby-on-the-Wreake”)<o></o>
<o></o>
Finally in cell D1 the formula would return any remaining part of the address in A1 (but to a maximum length of 30 characters)<o></o>
<o></o>
I know theres a lot here, but I’m tearing my hair out and would really appreciate assistance.<o></o>
<o></o>
Thanks<o></o>
<o></o>
<o>PS - just to complicate matters further - commas and other common address separators can be treated as spaces by the above formulae (i.e. its acceptable to break the address up at a comma, space, full stop, semi colon etc - but not acceptable to break a word up)</o>
<o></o>
There is a database that imports address fields from an excel spreadsheet. I have no control over the database, so I need to fix some import problems in Excel first.<o></o>
<o></o>
The address field can only accept 30 characters including spaces and special characters. But a good few of the addresses in excel are longer. So I need to transport the “offcuts” to address line 2 (and in some rare cases, 3 as well)<o></o>
<o></o>
So let’s say I had the following address in cell A1: “Flat 4A, <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-comffice:smarttags" /><st1:Street w:st="on"><st1:address w:st="on">12 Polkington Crescent</st1:address></st1:Street>, Frisby-on-the-Wreake Melton Mowbray” (68 Characters). <o></o>
<o></o>
Is there a formula in B1 which will test the length of the text field in A1, if over 30 characters, look for the nearest space before character 31 (in this case the space before “Crescent”) And return the part of the address up to that space (“Flat 4A, 12 Polkington”)<o></o>
<o></o>
In cell C1, the same principle – search the remainder of the address (“Crescent, Frisby-on-the-Wreake Melton Mowbray” (45 characters), then test the length of the remaining text field, if over 30 characters, look for the nearest space before character 31 (in this case the space before “Melton”) And return the part of the address up to that space (“Crescent, Frisby-on-the-Wreake”)<o></o>
<o></o>
Finally in cell D1 the formula would return any remaining part of the address in A1 (but to a maximum length of 30 characters)<o></o>
<o></o>
I know theres a lot here, but I’m tearing my hair out and would really appreciate assistance.<o></o>
<o></o>
Thanks<o></o>
<o></o>
<o>PS - just to complicate matters further - commas and other common address separators can be treated as spaces by the above formulae (i.e. its acceptable to break the address up at a comma, space, full stop, semi colon etc - but not acceptable to break a word up)</o>
Last edited: