Extract Unique Text from cell

pto160

Active Member
Joined
Feb 1, 2009
Messages
482
Office Version
  1. 365
Platform
  1. Windows
I have this report that I download and export from my ERP system into Excel. I have a column with the name and address in one cell on multiple lines. The name is in line 1. The problem I am having is that the name is repeated on the first line from some of the rows. I want the unique text from the name line, which is on the first line. I want to get rid of the text starting with when the first word repeats itself.
This is a bit tricky because the second time the first word repeats itself, there is no space between the last word of the unique text and the second occurrence of the first word.

Book1
ABC
1NameFormulaDesired Result
2Precision EngineeringPrecision Engineering 3900 Waterloo Steet London WGGE15Precision EngineeringPrecision EngineeringPrecision Engineering
3California Health ClinicCalifornia Health Clinic 45 Upper Town Ave California, CA 94102California Health ClinicCalifornia Health ClinicCalifornia Health Clinic
4Townsend Mousetraps 1460 Sussex Street Sussex WEGG5Townsend MousetrapsTownsend Mousetraps
Sheet1


Is there a way to do this?
 
Everyone thanks for all your help. The VBA, power query and formulas all work great. (y):) This will save me a lot of time with working with names.
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
You are welcome

update for post#3

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Index = Table.AddIndexColumn(Source, "Index", 1, 1),
    ETBD = Table.TransformColumns(Index, {{"Name", each Text.BeforeDelimiter(_, Character.FromNumber(10)), type text}}),
    SplitSpace = Table.ExpandListColumn(Table.TransformColumns(ETBD, {{"Name", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Name"),
    CountUpper = Table.AddColumn(SplitSpace, "Custom", each Text.Length(Text.Select([Name], {"A".."Z"}))),
    Distinct = Table.Distinct(Table.SelectRows(CountUpper, each ([Custom] = 1)), {"Name"}),
    List = Table.AddColumn(Table.Group(Distinct, {"Index"}, {{"Count", each _, type table}}), "Custom", each [Count][Name]),
    Extract = Table.TransformColumns(List, {"Custom", each Text.Combine(List.Transform(_, Text.From), " "), type text}),
    TSC = Table.SelectColumns(Extract,{"Custom"})
in
    TSC
 
Upvote 0
Thanks Sandy666 for the power query update. I've started to use the Power Query Microsoft tutorial to teach myself more about this feature.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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