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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
very informative video; but what formula should I use to update (for bringing SUITE infront of the addresses)?
 
Upvote 0

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
7,475
Office Version
  1. 365
Platform
  1. Windows
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,190,600
Messages
5,981,871
Members
439,741
Latest member
mblacklock

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
Top