Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Coffeyam
New Member

Sentence Extraction - Need Help

Hi, I am using Excel Power Query and I have a list of keywords that I search for in a large group of text. I am wondering if anyone knows how I can extract the sentences every time a keyword is found. So if a keyword is found in the text then it would look for the surrounding . ! Or ? and then return the sentence within the punctuation where that keyword was found.

 

Is that possible with Power Query?

 

Thanks!

1 REPLY 1
edhans
Super User
Super User

You should split the block of text based on punctuation. For example, I have a bunch of file names here. I am going to split them by the ".xlsx" delimiter.

edhans_0-1695861130432.png

That will split the sentences into rows. So you don't have to do this multiple times, I'd recommend you replace the period, exclamation point and question mark with .xxx, ?... and !xxx first. Then your delimiter is the "xxx" char.

Once every sentence is on a new row, you can add a column and use the Text.Contains() function. Text.Contains - PowerQuery M | Microsoft Learn

For any sentences that don't return a value, filter those rows out.

For more help, we'd need data. 
How to get good help fast. Help us help you.

How To Ask A Technical Question If you Really Want An Answer

How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors