Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel formula, find the first instance of OU= in string and remove any characters before it

Tags:

excel

I have 1000's of strings similar to "CN=Joe Smith,OU=Students,DC=Domain,DC=Edu" and I want to find the first instance of OU= and remove the characters before it leaving me with "OU=Students,DC=Domain,DC=Edu". How can I do this with an Excel formula?

Many thanks Jamie

like image 527
Jamie Avatar asked Jul 20 '10 08:07

Jamie


People also ask

How do I get rid of text before or after a character in Excel?

Press Ctrl + H to open the Find and Replace dialog. In the Find what box, enter one of the following combinations: To eliminate text before a given character, type the character preceded by an asterisk (*char). To remove text after a certain character, type the character followed by an asterisk (char*).

How do I remove a character from the beginning of a string in Excel?

To delete the first character from a string, you can use either the REPLACE function or a combination of RIGHT and LEN functions. Here, we simply take 1 character from the first position and replace it with an empty string ("").

How do I find the first occurrence of a string in Excel?

You use the FIND function to locate the first dash in the string and add 1 to that value because you want to start with the character that follows the dash: FIND("-",A2)+1. 3rd argument (num_chars). Specifies the number of characters you want to return.


1 Answers

Use this:

=RIGHT(A1,LEN(A1)-FIND("OU=",A1)+1)
like image 164
jevakallio Avatar answered Sep 27 '22 21:09

jevakallio