Extract and Copy Text Between Repeating Characters

mjcanty

New Member
Joined
Feb 9, 2016
Messages
17
Office Version
  1. 2016
Platform
  1. Windows
Hello! I am trying to extract and copy text that is in between the first and second colon ":" in each cell in column A and copy said text into column B. In this example, "California" is the text in between the first and second colon ":" but that will not always be the case. The problem that I am having is that that are additional colons that are in each cell. How would I achieve this? Thanks in advance!!

United States:California:Alameda:Oakland
United States:California:Alameda:Berkeley
United States:California:Alameda:San Leandro
United States:California:Alameda:Castro Valley
United States:California:Alameda:Dublin
United States:California:Alameda:Pleasanton
 
Last edited by a moderator:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try this formula (for an entry in cell A1:
Excel Formula:
=TRIM(MID(SUBSTITUTE(A1,":",REPT(" ",100)),100,100))
 
Upvote 0
Does this formula work for you....
Excel Formula:
=TRIM(MID(SUBSTITUTE(A1,":",REPT(" ",99)),99,99))
 
Upvote 0
with Power Query
sourceResult
United States:California:Alameda:OaklandCalifornia
United States:California:Alameda:BerkeleyCalifornia
United States:California:Alameda:San LeandroCalifornia
United States:California:Alameda:Castro ValleyCalifornia
United States:California:Alameda:DublinCalifornia
United States:California:Alameda:PleasantonCalifornia

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    ETBD = Table.AddColumn(Source, "Result", each Text.BetweenDelimiters([source], ":", ":"), type text),
    TSC = Table.SelectColumns(ETBD,{"Result"})
in
    TSC
 
Upvote 0

Forum statistics

Threads
1,215,495
Messages
6,125,149
Members
449,208
Latest member
emmac

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