Find certain words (2/3/4/5 words) in a paragraph

aimkmb

New Member
Joined
Jan 2, 2019
Messages
4
HI,
I would like a formula that could find certain exact words ( 2 - 5 words) in a paragraph, and returns with values.
Eg 3 exact words found in a paragraph, return values = 3

thanks....
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

Hi,

What is for you ... a paragraph ???

Are you working with Excel ... or with Word ...???
 
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

Hi,

What is for you ... a paragraph ???

Are you working with Excel ... or with Word ...???

excel. short paragraph / sentence containing aroung 10 - 15 words..
 
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

is that what you want?
(with single sentence)

sentence
I would like a formula that could find certain exact words ( 2 - 5 words) in a paragraph, and returns with values
words
find certain exact words
Column1
5​

5 because words is twice
 
Last edited:
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

yes exactly! would you mind share how to do the formula...thanks!
 
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

sure but PowerQuery is required

for source table
Code:
[SIZE=1]let
    CharsToReplace = List.Transform({33..64,91..96,123..126}, each Character.FromNumber(_)),
    Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"sentence", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "sentence"),
    #"Added Custom" = Table.AddColumn(#"Split Column by Delimiter", "TT", each Text.Trim([sentence],CharsToReplace)),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([TT] <> ""))
in
    #"Filtered Rows"[/SIZE]

for words list table
Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table8"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"words", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "words")
in
    #"Split Column by Delimiter"[/SIZE]

for result table
Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table8,{"words"},Table7,{"TT"},"Table7",JoinKind.LeftOuter),
    #"Expanded Table7" = Table.ExpandTableColumn(Source, "Table7", {"TT"}, {"TT"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Table7", each ([TT] <> null)),
    #"Calculated Count" = List.NonNullCount(#"Filtered Rows"[TT]),
    #"Converted to Table" = #table(1, {{#"Calculated Count"}})
in
    #"Converted to Table"[/SIZE]
 
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

sure but PowerQuery is required

for source table
Code:
[SIZE=1]let
    CharsToReplace = List.Transform({33..64,91..96,123..126}, each Character.FromNumber(_)),
    Source = Excel.CurrentWorkbook(){[Name="Table7"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"sentence", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "sentence"),
    #"Added Custom" = Table.AddColumn(#"Split Column by Delimiter", "TT", each Text.Trim([sentence],CharsToReplace)),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each ([TT] <> ""))
in
    #"Filtered Rows"[/SIZE]

for words list table
Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table8"]}[Content],
    #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(Source, {{"words", Splitter.SplitTextByDelimiter(" ", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "words")
in
    #"Split Column by Delimiter"[/SIZE]

for result table
Code:
[SIZE=1]let
    Source = Table.NestedJoin(Table8,{"words"},Table7,{"TT"},"Table7",JoinKind.LeftOuter),
    #"Expanded Table7" = Table.ExpandTableColumn(Source, "Table7", {"TT"}, {"TT"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Table7", each ([TT] <> null)),
    #"Calculated Count" = List.NonNullCount(#"Filtered Rows"[TT]),
    #"Converted to Table" = #table(1, {{#"Calculated Count"}})
in
    #"Converted to Table"[/SIZE]

Thanks for sharing this useful info! ?
 
Upvote 0
Re: Help! Find certain words (2/3/4/5 words) in a paragraph

You are welcome

btw. don't quote whole post
 
Upvote 0

Forum statistics

Threads
1,215,731
Messages
6,126,535
Members
449,316
Latest member
sravya

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