1 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

How to remove all characters that are not between square brackets?

Sorry if this is a repost but all the posts I was finding on how to achieve what I'm looking for offered the inverse of what I was after.

  • There is a table with hundreds of thousands of rows.
  • Two columns contain text.
  • Within that text there are characters between square brackets, sometimes more than more than one square bracketed text per line.

How does one go about removing all characters that are not between square brackets (thus keeping all the text between the square brackets only)?

(Please be gentle, taking excel beyond just tables is relatively new to me.)

UPDATE: there are more than one square brackets in a line of text & I am using either Exel2016 or 2019 desktop versions.

SOLUTION UPDATE:

  • Enter Power Query > Add Column > Custom Column
  • Remember to change [YourColumnName] to the Column you wish to extract the Square Brackets and their Bracketed text From

Text.Combine( List.Transform( Text.Split([YourColumnName], "["), each if Text.Contains(_, "]") then "[" & Text.BeforeDelimiter(_, "]") & "]" else "" ) ) 
submitted by /u/Quiet-Section-3391
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article

Tagged with

#Excel alternatives for data analysis
#rows.com
#Excel compatibility
#Excel alternatives
#natural language processing for spreadsheets
#generative AI for data analysis
#financial modeling with spreadsheets
#no-code spreadsheet solutions
#square brackets
#text extraction
#Power Query
#custom column
#Excel 2016
#Excel 2019
#characters removal
#Text.Combine
#Text.Transform
#List.Transform
#Text.Split
#delimiter