Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have a string in a cell:


ABCD and EFGH are constants, and xxxxx is of variable length.

How do I write an Excel formula to extract xxxxx?

share|improve this question

migrated from Sep 22 '09 at 2:44

This question came from our site for professional and enthusiast programmers.

Assuming it is in Cell A1


If you wanted to check that the cell is correctly formed you could do:

share|improve this answer
+1 for the format check – Tracy Probst Oct 7 '09 at 16:09

If you just want to brute force it (assuming ABCD and EFGH aren't within xxxxx then the following approach should work, although I would recommend you come up with a better method.

myvariable = split(split(cell, "ABCD")(1), "EFGH")(0)

(Please excuse if my syntax is slightly off. It's been a while since I've been in VBScript.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.