thebeast22
thebeast22

Reputation: 103

Get a set of strings using Excel formula

I have the following naming pattern.
YEAR-REG-TYPE-LANGUAGE-CAMP-NAME_EMAIL#

How can I get all string after NAME using Excel formula?
Thanks!

Upvotes: 0

Views: 36

Answers (2)

Darren Bartrup-Cook
Darren Bartrup-Cook

Reputation: 19837

I'm taking it that you don't want to find the actual word 'Name' as it's the pattern you're after, so 'Name' will be an actual name and 'Email' will be an actual email address.

If you want to find NAME_EMAIL# then you need everything to the right of the 5th -.
This formula will return that:
=MID($A$1,FIND("|",SUBSTITUTE($A$1,"-","|",5))+1,LEN($A$1))

Returning just the email is easier as it has the only underscore in the string:
=MID($A$1,FIND("_",$A$1)+1,LEN($A$1))

Upvotes: 2

Tim Wilkinson
Tim Wilkinson

Reputation: 3791

You can use a combination of MID, FIND, and LEN like so

=MID(A2, FIND("NAME", A2, 1)+4, LEN(A2))

Where your data is in cell A2.

Upvotes: 3

Related Questions