Split and search for values in cell

Danny54

Active Member
Joined
Jul 3, 2019
Messages
295
Office Version
  1. 365
Platform
  1. Windows
Good Morning

I wondering if its possible to create a formula that would split a cell by a comma and keep only the values that start with "TV -".
Keep only unique values
Take the data and insert a line feed between each grouped value before saving it to the column as shown in the Output column below)

The data looks like this

Group
TV - Blue, TV - Blue, TV - Red, Parts, Wheels


The desired output would look like this

GroupOutput
TV - Blue, TV - Blue, TV - Red, Parts, WheelsTV - Blue,
TV - Red
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
With Power Query, aka Get and Transform Data and found on the Data Tab of the Ribbon

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Group", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Group"),
    #"Filtered Rows" = Table.SelectRows(#"Split Column by Delimiter", each ([Group] <> " Parts" and [Group] <> " Wheels")),
    #"Trimmed Text" = Table.TransformColumns(#"Filtered Rows",{{"Group", Text.Trim, type text}})
in
    #"Trimmed Text"
 
Upvote 0
How about
Excel Formula:
=LET(a,TRIM(TEXTSPLIT(A2,,",")),TEXTJOIN(CHAR(10),,UNIQUE(FILTER(a,LEFT(a,4)="tv -"))))
 
Upvote 0
=LET(a,TRIM(TEXTSPLIT(A2,,",")),TEXTJOIN(CHAR(10),,UNIQUE(FILTER(a,LEFT(a,4)="tv -"))))

When I insert this formula into my cell, I get the following

TV - BlueTV - Red

all on the same line. Do I need to have the cell formatted specifically so the data is split like

TV - Blue
TV - Red

Thanks
 
Upvote 0
You need to format the cell to Wrap Rows.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,446
Messages
6,124,897
Members
449,194
Latest member
JayEggleton

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