Separating numbers from a string of text

Anune153

New Member
Joined
Jul 7, 2020
Messages
2
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
  2. MacOS
Hi all!

I am pretty new to going beyond just the basics within excel. Currently, I am trying to clean data that is pretty simple but I want to automate the process as much as possible. Basically, participants from a survey were given a list of statements numbered 1-27 and then asked to list which statements they agreed with the most by listing the statement number. My first column looks like this: "1,22,3,5". Or some people didn't put commas so it may look like this: "1 22 3 5". Or a mix.

I want to be able to count how many times participants mentioned each statement, sort of like a count if, and place that total count on another cell rather than manually having to tally it myself. I am having difficulty I guess because I can't use the count if function with strings...

Any help is much appreciated, I have had difficulty explaining which is probably why my searches have come up empty. Thank you!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You could use Data>Data Tools>Text to Columns to convert either of the two string formats in your examples to individual numbers, each in a separate column..
 
Upvote 0
Hi, here is another option you could try.

Book1
ABCD
1
2StatementCount
31 22 3 515
41,22,4,521
51,22 3,534
61, 3 , 6 22 4,543
71 2 3 , 4, 5,6, 755
862
9224
Sheet1
Cell Formulas
RangeFormula
D3:D9D3=SUMPRODUCT(0+ISNUMBER(FIND(" "&C3&" "," "&TRIM(SUBSTITUTE($A$3:$A$100,","," "))&" ")))
 
Upvote 0
Hi, here is another option you could try.

Book1
ABCD
1
2StatementCount
31 22 3 515
41,22,4,521
51,22 3,534
61, 3 , 6 22 4,543
71 2 3 , 4, 5,6, 755
862
9224
Sheet1
Cell Formulas
RangeFormula
D3:D9D3=SUMPRODUCT(0+ISNUMBER(FIND(" "&C3&" "," "&TRIM(SUBSTITUTE($A$3:$A$100,","," "))&" ")))
Thank you very much!
 
Upvote 0
just for fun as an option...
with XL2016/Windows and Power Query
RawRawCount
1 22 3 515
1,22,4,521
1,22 3,534
1, 3 , 6 22 4,543
1 2 3 , 4, 5,6, 755
62
71
224

Rich (BB code):
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Split = Table.ExpandListColumn(Table.TransformColumns(Source, {{"Raw", Splitter.SplitTextByAnyDelimiter({",","."," "}, QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Raw"),
    Clean = Table.TransformColumns(Table.SelectRows(Split, each ([Raw] <> "")),{{"Raw", Text.Trim, type text}}),
    Group = Table.Group(Clean, {"Raw"}, {{"Count", each Table.RowCount(_), type number}}),
    PadStart = Table.AddColumn(Group, "Custom", each Text.PadStart([Raw], 2, "0")),
    RC = Table.RemoveColumns(Table.Sort(PadStart,{{"Custom", Order.Ascending}}),{"Custom"})
in
    RC
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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