String manipulation

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hello Friends

Could you please help me with the following?

In one of my tables I have column Address. Typical address looks like 6158 1313Street Suit12
I need it to appear like Suit12 6158 1313Street.
Not all the addresses have Suit in them.

Thanks for your help
Rajesh
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
very informative video; but what formula should I use to update (for bringing SUITE infront of the addresses)?
 
Upvote 0
Using the same concepts, I used the Len Function, the Right Function, the Left Function and the Instr Function. The Instr Function acts much like the find function in Excel. Here is the SQL Statement

Code:
SELECT Table1.ID, Table1.Address, Len([Address]) AS Length, InStr([Address],"Suite") AS Suite,
Right([Address],Len([Address])-InStr([Address],"Suite")+1) AS Suite1,
Left([Address],Len([Address])-Len([Suite1])) AS Address1, 
[Suite1] & " " & [Address1] AS TAddress
FROM Table1;

You will have to change your names accordingly. There are some superfluous fields here but once you figure this on your own, you can delete them.

Alan
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top