Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to use regex substitution with Excel find & replace (in the GUI)?

Using a JavaScript example, I want to do something like this:
"John Smith".replace(/(.*)\s(\.*)/, "$2, $1") // returns "Smith, John"

share|improve this question
up vote 3 down vote accepted

There is an add-on at www.codedawn.com that adds regexp functionality to MS Excel's find&replace dialog. That's the answer! Just one note: replacements made by this add-on are NOT UNDOABLE. You will be warned to save your workbook before committing replace.

share|improve this answer
    
Thanks, exactly what I was looking for - though I was surprised its not built-in. Actual link is codedawn.com/excel-add-ins.php. – studgeek Dec 3 '11 at 18:37

I beleive you can get similar functionality combining Excel's FIND and MID functions - note that if what you're finding (the "\s" in your example) is a wildcard also, your function will probably get very long - but it's possible. See this article for some (fairly simple) examples.

share|improve this answer
    
Thanks, but I was actually looking for it in the GUI, which wasn't clear in my original question so I updated it. – studgeek Dec 3 '11 at 18:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .