Excel Formula - How to extract values between commas?

YSWOO

New Member
Joined
Dec 7, 2020
Messages
10
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
  2. Mobile
example

RANGE (A1) : AA, BB, CC, DD, EE, FF, GG, HH

TARGET
(B1) : AA
(B2) : BB
(B3) : CC
(B4) : DD
(B5) : EE
(B6) : FF
(B7) : GG
(B8) : HH

I made second part, but after second, i do not know how to make it...
=MID(A1,FIND(",",A1)+1,FIND(",",A1,FIND(",",A1)+1)-(FIND(",",A1)+1))

please help me to do..
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
rawraw
AA, BB, CC, DD, EE, FF, GG, HHAA
BB
CC
DD
EE
FF
GG
HH

Power Query:
// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"raw", Splitter.SplitTextByDelimiter(", ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "raw")
in
    Split
 
Upvote 0
Thanks for your answer!!!

BUT, can i get the answer just "formula" ?

i do not know how to use of power query...
 
Upvote 0
Try this to extract BB
=TRIM(MID(A1,FIND("#",SUBSTITUTE(A1,",","#",1))+2,2))

For CC, change the bold number to 2 and so on.

In SUBSTITUTE that bold number is instance number. The comma is replaced by # for Nth instance of comma and use FIND to find starting position for MID function. That's how it works.
 
Upvote 0
VBA Option
VBA Code:
Public Sub extract_values_between_commas()

Dim TxT As Variant
TxT = Split(Range("A1"), ",")

Range("B1:B" & UBound(TxT) + 1) = WorksheetFunction.Transpose(TxT)

End Sub
 
Upvote 0
Formula option
Test.xlsx
AB
1AA, BB, CC, DD, EE, FF, GG, HHAA
2BB
3CC
4DD
5EE
6FF
7GG
8HH
aa
Cell Formulas
RangeFormula
B1B1=IFERROR(LEFT(RIGHT(","&$A$1&",",LEN(","&$A$1&",")-FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1))),FIND(",",RIGHT(","&$A$1&",",LEN(","&$A$1&",")-FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1))))-1),"")
 
Upvote 0
Feed back please

Correction
Excel Formula:
MID(A1,FIND(",",A1)+1,FIND(",",A1,FIND(",",A1)+1)-(FIND(",",A1)+1))
is
Excel Formula:
=IFERROR(TRIM(MID($A$1,FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1)),FIND("|",SUBSTITUTE(" "&$A$1&",",",","|",ROW()-ROW($B$1)+1))-FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1))-1)),"")

Test.xlsx
AB
1AA, BB, CC, DD, EE, FF, GG, HHAA
2BB
3CC
4DD
5EE
6FF
7GG
8HH
aa
Cell Formulas
RangeFormula
B1:B8B1=IFERROR(TRIM(MID($A$1,FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1)),FIND("|",SUBSTITUTE(" "&$A$1&",",",","|",ROW()-ROW($B$1)+1))-FIND("|",SUBSTITUTE(","&$A$1&",",",","|",ROW()-ROW($B$1)+1))-1)),"")
 
Upvote 0
I took a my mistake!

AA, BB, CC... -> That is sample for looking convinient.

Actually, the Original Text is random. Just all text is located between commas.

It could be like AAA, BB, CCC,DDDDDD,EEEEEEEEEE,F.

Could you help me to figure it out?

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,429
Messages
6,119,433
Members
448,897
Latest member
ksjohnson1970

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