Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Formatting records in Excel
Message
Information générale
Forum:
Microsoft Office
Catégorie:
Excel
Divers
Thread ID:
01031081
Message ID:
01032188
Vues:
16
I don't think you can do that with just formatting. A macro could be written, but if this is a one time thing, you can make it easier to enter in excel.

First, save the sheet.
Add some columns to the right of the address column.
The number of columns is the max number of spaces in your addresses and then a few more.

Highlight the cells you have not done manually.
Under the data menu, select text to columns and delimited by spaces.
If it warns you that you are overwriting, then you did not add enough blank columns earlier.
Now you should have columns with the parts of the address spread out.
Add another column to the right of the number you are wanting to format.
Note: This assumes you have the number you're formatting is the first column of the parsed columns.
In that first row of the first column enter a formula like this:
=CONCATENATE(LEFT(A1,LEN(A1)-2),"-",RIGHT(A1,2))
In my example cell A1 is the cell with the number you want to format.
Copy that cell down the list.
This should give you values like 108-80 and 10-80.
In the first row of the furthest right column of the ones you added, enter a formula simular to this:
=TRIM(CONCATENATE(B1," ",C1," ",D1," ",E1," ",F1))
In my example cell B1 is the number you just formated with the earlier formula.
The column I put my formula in is column G. Your formula will probably be longer, but the same pattern.
Copy that cell down the list.

That gives you the results you want.
If everyhting looks good, save the file, or make a backup.
Now, copy those results (just the cells you edited) and "Paste Special" this over the original cells.
For my examples, the cells I wanted to edit were in column A.
Then delete all the columns you added earlier.

This can be done with only one long formala, but this is easier to follow.

Hope it helps and if I'm too late, you'll know how to do it next time.



>Hi everybody,
>
>I have records with different formatting. Some have 108-11 65 Rd, which is correct, and some 8083 118 St, which is wrong. I'd like to insert a dash between first 2 or 3 numbers and then last 2 before the first space, e.g.
>
>10880 would become 108-80
>1080 would become 10-80
>
>I also have - inserted already in ~30% of records, which need to be preserved...
>
>Is it possible?
>
>Thanks in advance.
___________________________
Kenneth Wonderley
http://www.wonderley.com


...the fruit of the Spirit is love, joy, peace, patience, kindness, goodness, faithfulness, gentleness and self-control.
Galatians 5:22 & 23
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform