Need to create a project schedule? Try our Gantt Chart for Excel!

Text Manipulation Formulas in Excel – The Ultimate Guide

Text Formulas in Excel

When you are cleaning up data in Excel, the Text-to-Columns and Flash Fill features are awesome, but sometimes you need to use formulas to manipulate text. In this article I'll demonstrate examples of the text formulas I commonly use, including LEN, TRIM, UPPER, LOWER, PROPER, CONCATENATE, INDIRECT, CHAR, FIND, SEARCH, SUBSTITUTE, LEFT, RIGHT, MID and REPLACE (and some others).

The examples start very simple and then get progressively more advanced as you scroll through the page, building upon earlier examples.

Do you have a text manipulation challenge that you need a formula to solve? Feel free to ask your question by commenting below.

1. Get the LENgth of a text string

=LEN("onetwothree")
Result: 11

This comes in handy when you need to write a title for a web page or complete a form with a limited number of characters. Just open a blank spreadsheet and type your title in cell A1. In B1, enter =LEN(A1).

2. Change case to UPPER, lower, or Proper

=UPPER("this text")   Result: THIS TEXT
=LOWER("THIS TEXT")   Result: this text
=PROPER("this text")   Result: This Text

3. Concatenate a text string

You can use CONCATENATE, the & operator, or the newer CONCAT and TEXTJOIN functions to concatenate strings. The following formulas combine a first name in cell A1 and a last name in cell B1 with a space in the middle. The result is "John Smith" for all four formulas.

A1="John"
B1="Smith"

=A1 & " " & B1
=CONCATENATE(A1," ",B1)
=CONCAT(A1:B1)
=TEXTJOIN(" ",TRUE,A1:B1)

Result: "John Smith"

NOTE The spaces before and after the & operator are not required - I've included the spaces only to help make the formula more readable.

The CONCAT and TEXTJOIN functions are new functions that requires an Office 365 subscription (they work in Excel Online). The CONCAT function is like CONCATENATE except that it lets you use a range of cells as an argument. The TEXTJOIN function lets you specify a delimiter and ignore blank values.

4. Use INDIRECT to create a reference from a text string

The INDIRECT function allows you to create a reference from a text string. The example below shows a reference to cell A5 in worksheet 'Sheet 2'. The single quotes around the worksheet name are only necessary if the worksheet name includes a space.

=INDIRECT("'Sheet 2'!A5")

Use INDIRECT if you want the worksheet name to be a text string chosen by the user. For example, you may want to do this if you have many identical worksheets and you want to create a summary table that uses the names of those worksheets as references in your lookup formulas.

The following example creates a reference to cell X5 in a worksheet that is named in cell A1.

A1="Sheet 2"
A2=INDIRECT("'" & A1 & "'!X5")

The INDIRECT function can be very useful in array formulas. For example, to create an array of numbers 1 through N, where N is a number contained in cell A1, you can use:

=ROW(INDIRECT("1:" & A1))

5. Use CHAR to return special characters

The CHAR function lets you return a character for a given numeric code. The UNICHAR function returns a character for a decimal Unicode value. Although most of the numeric codes for the CHAR function correspond to the ASCII codes, some may not be the same (such as codes 128-160).

The functions CODE and UNICODE are the opposites of CHAR and UNICHAR, returning the numeric value for the first character in a text string.

Use CHAR(34) to return the double quote " character

When you concatenate text and need to include double quotes in the displayed text, you can use the CHAR(34) or UNICHAR(34) function. Both the ASCII and Unicode value for double quotes is 34.

=CHAR(34) & "Hi World" & CHAR(34)
Result: "Hi World" (quotes included)

Use CHAR(10) to include a line break in a string

When using a formula to return a string, use CHAR(10) or UNICHAR(10) for a line break. See Custom Number Formats to learn how to add a line break within a custom number format (for chart labels and stuff like that).

="abc" & CHAR(10) & "def"
Result:
abc
def

! To display wrapped text with line breaks, the cell must also have the Word Wrap property toggled on.

TIP To quickly generate a list of characters based on their numeric code, enter =CHAR(ROW()) or =UNICHAR(ROW()) into cell A1 of a blank worksheet and copy the formula down.

See my article "Using UNICODE Characters in Excel" for more information.

6. SUBSTITUTE text within a string

The SUBSTITUTE function is very powerful. It can be used to replace ether ALL occurrences or just the Nth occurrence of a string with another character or text string. In the example below, we're replacing the # character with a space.

text = "one#two#three"
=SUBSTITUTE(text,"#"," ")   Result: "one two three"
=SUBSTITUTE(text,"#"," ",2)   Result: "one#two three"

7. Use TRIM to get rid of extra spaces

The TRIM function removes all regular spaces (ASCII character 32) except for a single space between words.

=TRIM("   Hi  World  ")
Result: "Hi World"  (quotes not included)

TRIM does not remove tabs, line breaks, or other nonprinting characters from the text. To remove the non-printing ASCII characters 0-31 (including the tab character), you can use the CLEAN function.

text="Hi		World" (contains two tabs)
=CLEAN(text)
Result: "HiWorld"

The problem with the CLEAN function is that it completely removes the characters, so words separated by tabs or newline characters will be combined, so you may end up with "HiWorld" when you would prefer "Hi World".

To change special characters to regular spaces, you can use the SUBSTITUTE function and then wrap the function with TRIM to remove extra spaces like this:

text="Hi		World" (contains two tabs)
=TRIM( SUBSTITUTE(text,CHAR(9)," ") )
Result: "Hi World"

NOTE Here is a short list of CHAR codes for commonly replaced characters: Tab (9), Newline (10), Carriage Return (13), Space (32), Non-Breaking Space (160), Special Quote Symbols: ‘(145), ’(146), “(147), ”(148)

8. Use FIND and SEARCH to get the position of text in a string

The FIND function for case-sensitive searching and the SEARCH function for case-insensitive searching will return the starting character position of a text string within another string.

=FIND("a","ooAooaoo",1)   Result: 6
=SEARCH("a","ooAooaoo",1)   Result: 3

The 3rd argument of the FIND and SEARCH functions is the starting character position to begin the search, with the default being 1 (the first character). You can use a nested FIND or nested SEARCH to find the position of the 2nd occurrence of a text string like this:

text="ooAooAoo"
=FIND("A",text,FIND("A",text,1)+1)

Evaluation Steps
Step 1: FIND("A","ooAooAoo",3+1)
Step 2: FIND("A","ooAooAoo",4)
Step 3: 6

You can do some really tricky things with SUBSTITUTE when combined with FIND or SEARCH. The following function allows you to find the location of the Nth occurrence of a string within another text string. In this example, we want to know the position of the 3rd space in the name.

text="Tim A. J. Crane"
=FIND("#",SUBSTITUTE(text," ","#",3),1)

Evaluation Steps
Step 1: =FIND("#","Tim A. J.#Crane",1)
Step 2: =10

9. Use MID, LEFT and RIGHT to extract text from a string

The MID function is like the substr() function in other coding languages. It extracts a string from within another string by specifying the starting character position and the number of characters to extract. The REPLACE function is similar except that it returns the original text string with the text replaced. The LEFT and RIGHT functions are like shorthand versions of MID for extracting text from the left or right end of a string.

SYNTAX: =MID(text,start_num,num_chars)
SYNTAX: =REPLACE(text,start_num,num_chars,replace_text)
SYNTAX: =LEFT(text,num_chars)
SYNTAX: =RIGHT(text,num_chars)

Below is an example showing how these functions work.

text = "one#two#three"
=MID(text,5,3)   Result: "two"
=REPLACE(text,5,3,"BLAHBLAH")   Result: "one#BLAHBLAH#three"
=LEFT(text,5)   Result: "one#t"
=RIGHT(text,7)   Result: "o#three"

I haven't had much use for the REPLACE function, because I typically use SUBSTITUTE instead of REPLACE.

The MID, LEFT, and RIGHT functions become much more powerful when you use the FIND or SEARCH functions within them. Some of the following tips show examples of that.

10. Count the number of spaces in a text string

You can use this technique to count other characters besides spaces. For example, just substitute " " with "," or ";" to count the number of commas or semi-colons.

text = "Todd Allen Smith"
=LEN(text)-LEN(SUBSTITUTE(text," ",""))

Evaluation Steps
Step 1: LEN("Todd Allen Smith")-LEN("ToddAllenSmith")
Step 2: 16-14
Step 3: 2

The SUBSTITUTE function in this example returns a new text string with the spaces removed (replacing all " " with ""). We are subtracting the length of that modified text string from the original length to calculate the number of spaces in the original text.

11. Count occurrences of a string within text

If you want to count the number of occurrences of a string within text (instead of just a single character), then you can use a slightly modified version of the above formula. In this case, we'll just divide the result by the length of string.

text = "A##B##C"
string = "##"
=(LEN(text)-LEN(SUBSTITUTE(text,string,""))) / LEN(string)
Result: 2

12. Split text into columns using formulas

The Text-to-Columns Wizard and Flash Fill (Ctrl+e) features in Excel are fast and simple to use, but there may be times when you want to use formulas instead (to make a more dynamic or automated worksheet). Splitting up text using formulas typically involves a combination of LEFT, RIGHT, MID, LEN, and FIND (or SEARCH). We'll start with a couple simple formulas.

Extract the First Name

To extract the first word (or name) from a text string, you can use the following formula, where text is either a cell reference or a string surrounded by double quotes like "this".

text = "Tom Sawyer"
=LEFT(text,FIND(" ",text)-1)

Evaluation Steps
Step 1: =LEFT("Tom Swayer",4-1)
Step 2: =LEFT("Tom Swayer",3)
Step 3: ="Tom"

In the above formula, FIND(" ",text) returns the numeric position of the first space " " within the text. We subtract one from that value so the space is not included in the result.

Extract the Text After the First Space

To return the rest of the string after the first space, we use the RIGHT function, which extracts a specified number of characters from the end of the string. We calculate the number of characters to extract by subtracting the position of space from the total length of the string:

text = "Jay Allen Reems"
=RIGHT(text,LEN(text)-FIND(" ",text))

Evaluation Steps
Step 1: =RIGHT("Jay Allen Reems",LEN("Jay Allen Reems")-4)
Step 2: =RIGHT("Jay Allen Reems",15-4)
Step 3: =RIGHT("Jay Allen Reems",11)
Step 4: ="Allen Reems"

We could repeat these formulas in other columns to extract Allen and then Reems.

The article "Split text into different columns with functions" on support.office.com provides various examples of formulas for separating names into different parts based on different ways that a name may be written.

The SPLIT function in Google Sheets

I hope that Excel eventually includes a SPLIT function like the one available in Google Sheets. For example, to split a name like "Allen James Reems" into separate cells only requires the following simple formula:

=SPLIT(text," ")

If you'd like to see a SPLIT function in Excel, vote on this suggestion via excel.uservoice.com.

13. Get the last word in a string

For this example, we'll use the name "Allen Jay Reems" to show how to get the last word in a string, where a space character is the delimiter. This example shows how I sometimes build a more complicated formula using intermediate steps.

delimiter = " "
last_name
   =RIGHT(text,LEN(text)-position_of_last_delimiter)
position_of_last_delimiter
   =FIND("^", SUBSTITUTE(text,delimiter,"^",number_of_delimiters))
number_of_delimiters
   =LEN(text)-LEN(SUBSTITUTE(text,delimiter,""))

The final formula looks like this with A1="Allen Jay Reems" and will return the last name "Reems":

=RIGHT(A1,LEN(A1)-FIND("^", SUBSTITUTE(A1," ","^",LEN(A1)-LEN( SUBSTITUTE(A1," ","") ))))

If you have a string delimited by commas like "one, two, three, four" you can extract the last element by replacing " " with "," in the above formula and wrapping the entire thing with TRIM to remove the leading space.

If your string might not contain any spaces, then you can wrap the entire formula with IFERROR to return an empty string or the original text.

If your string contains the "^" character, you'll need to choose a different temporary delimiter to use in the formula such as "~" or another uncommonly used character.

14. Get the Nth word in a string

This function is really crazy, but useful. I learned it from a post on mrexcel.com. Basically what is going on is that you replace the delimiter text with a bunch of blank spaces so that you create a new text string that can be divided into chunks, where each chunk contains a different word. There will be a lot of space surrounding each word, so you use TRIM to remove it.

text = "One#Two#Three" (the original text)
delimiter = "#" (the delimiter text)
word_num = 2 (the word to extract)

=TRIM(MID(SUBSTITUTE(text,delimeter,REPT(" ",LEN(text))),(word_num-1)*LEN(text)+1,LEN(text)))

Evaluation Steps
1: =TRIM(MID(SUBSTITUTE(text,"#",REPT(" ",13)),(2-1)*13+1,13))
2: =TRIM(MID(SUBSTITUTE(text,"#","             "),14,13))
3: =TRIM(MID("One             Two             Three",14,13))
4: =TRIM("  Two        ")
5: ="Two"

In Google Sheets, this is a piece of cake. The SPLIT function returns an array, so you can return the 3rd word in a string using:

=INDEX(SPLIT(text,delimiter),3)

15. Convert a text string to an array of words

Want to convert "One#Two#Three" into an array like {"One";"Two";"Three"} that can be used within other formulas? That is what the SPLIT function in Google Sheets does, but to do this in Excel is still possible - it's just complicated. First, start with the formula in the previous section and replace word_num with the following:

=ROW(INDIRECT("1:"&((LEN(text)-LEN(SUBSTITUTE(text,delimiter,"")))/LEN(delimiter)+1)))

To display the results within an array of cells, remember to use Ctrl+Shift+Enter. Use TRANSPOSE if you want to display the results of this formula in a row instead of a column.

To create the array as an inline text string, you can use the following formula:

text = "One#Two#Three" (the original text)
str = "#" (the delimiter text)
="{"&CHAR(34)&SUBSTITUTE(text,str,CHAR(34)&";"&CHAR(34))&CHAR(34)&"}"

Resulting text string: {"One";"Two";"Three"}

16. Convert a text string to an array of characters

If you want to split a text string into an array of individual characters, such as converting "abcd" to {"a";"b";"c";"d"}, the formula is fairly simple. This formula is entered as an Array Formula (Ctrl+Shift+Enter).

=MID(text_string,ROW( INDIRECT("1:"&LEN(text_string)) ),1)

To convert each of the characters in a string to their numeric codes, wrap the above function with CODE or UNICODE. The formula would be entered as a multi-cell array to display each of the numeric values in a different cell.

The following formula in Google Sheets will convert a text string to a comma-delimited list of numeric code values.

text="Hello"
=ARRAYFORMULA( TEXTJOIN(",",TRUE, CODE(MID(text,ROW( INDIRECT("1:"&LEN(text)) ),1))) )
Resulting text string: "72,101,108,108,111"

17. Use EXACT for case-sensitive text comparisons

If you ever need to determine if the text in a cell is UPPERCASE, lowercase, or Proper Case, you can use the EXACT formula to compare the original text to the converted text.

The following formulas return TRUE if the text in cell A1 is uppercase, lowercase or proper case, respectively:

=EXACT(A1,UPPER(A1))
=EXACT(A1,LOWER(A1))
=EXACT(A1,PROPER(A1))

Note: The SUMIF and COUNTIF article provides a lot of different examples of text-based comparisons.

Have a Text Formula Challenge?

If this article hasn't answered your question, feel free to comment below if you have a problem that you want solved using a text formula. Make sure to provide sufficient detail for your question to be answered. Thank you!

Comments

31 comments… add one
  • thank you for sharing !!!

    Reply
  • I have a list of names where the parts of the names are all jumbled up! I need to arrange the names in a particular order so that the number of unique names can be identified and then we can apply the VLOOKUP formula for further calculations.

    The name Juãn Carlos Da Silva would appear either as Juãn Carlos DA SILVA or DA SILVA Juãn Carlos etc.
    The name J. Morrison would appear either as J. MORRISON or MORRISON J.

    There are hundreds of thousands of rows with about 10000 unique names (may be more!), each form of the name appearing multiple times! The following are the properties I could locate myself:

    1. Each name would have at least 1 first name and 1 last name.
    2. Each name has 0 to 4 middle names.
    3. Each part of the name, the first, last as well as the middle name(s), has at least 2 characters.
    4. The last name is always in Upper Case.
    5. The first name is always in Proper Case or only the first letter in upper case followed by a “.” (dot).
    6. The middle name(s) may be either in Proper Case or in Upper Case.
    7. Each part of the name may contain the Latin-1 supplement characters like ã, õ, ù, Á, Ç, Ü etc, as is there in the example given above.
    8. Each part of the name may contain “-” (hyphen).
    9. The last name does not have the “.” (dot).
    10. The middle name(s) may have the “.” (dot) or also the “-” (hyphen).
    11. The “.” (dot), if it is there, is at the end of the first or a middle name.
    12. No name has more than one “.” (dot).
    13. The first letter of each name is an upper case letter.
    14. The proper case words in the name appear next to each other, either at the beginning or at the end. So are the upper case words in the name.

    Need a formula to convert the names to make them appear in one particular form. Using code is not an option. Macro is disabled as of now! Formula compatible with Excel 2007 would be much appreciated, however formula compatible with Excel 2010 would still work!

    Reply
    • @Michael … The answer to your question might require a full article to explain in detail. Without Googling to see if there is a more elegant solution, I’d probably tackle the problem by first splitting the names into columns (using the Text to Columns feature).

      Then, sort the names in each row in alphabetical order so that you could more easily compare duplicates. In other words, you want “J. C. MORRISON” and “MORRISON J. C.” to both become “C. J. MORRISON” so that you can later concatenate the names into a single column to use for identifying duplicates.

      To make this a piece of cake, I would copy or upload the list of names into Google Sheets because of the awesome SORT function. If your split names are located in columns A-D, then the following formula copied down in column E would create a new set of columns with each row sorted alphabetically: =TRANSPOSE(SORT(TRANSPOSE(A2:D2),1,TRUE))

      This is just a method for getting the data into a form that can be used to easily identify duplicates. If you need additional help, I would recommend contacting an expert Excel consultant to help you.

      Reply
      • Hi Jon,

        Thanks for the response. Also, let me apologize for not stating the problem more precisely!

        I already have a set of data with about 36 columns (Column A through AJ). The names appear in the 1st or the leftmost column A. I need to get the “formatted name” in an inserted column in each of the rows. There are and will be multiple occurrence of the same name in multiple rows. But if the names are in the same format, it would be easy and accurate to prepare the reports using VLOOKUP and Pivot Table and other standard Excel formula. Presently, because of the ways the names appear, VLOOKUP and Pivot Table are considering the same person as two or more different people!

        Also, (not sure if this changes the significance of the problem in any manner) let me point out that the kind of name you suggested in your response, C. J. Morrison isn’t there in the list, as it has 2 “.” (dot) characters. As I mentioned earlier, in point number 12, there’s at most 1 “.” (dot) in a name and that isn’t in the last name (mentioned in point 9).

        Reply
        • That’s fine. Just insert a bunch of columns as needed so that you can work with the names. Or temporarily copy the names into a separate spreadsheet so that you can do the manipulation (making sure to preserve the row order).

  • Good Morning,

    I was wondering if there was a formula to convert numbers as follows…
    #####.#### with no decimal
    4 twould need to read 000040000
    1.20 would need to be 000012000
    12.3666 to 000123666

    Any advice would be greatly appreciated.

    Thank you, Krista

    Reply
    • @Krista, I would probably use the formula =value*10000 and then use a Custom Number Format of 000000000. Or, you could use the formula =TEXT(A1*10000,”000000000″) where your list of numbers starts with cell A1. The result of the TEXT formula will be text (not a number), but maybe that’s what you want.

      Reply
  • Hi- I am familiar with excel, but I only at a basic level. I have started collecting data on a spreadsheet. It is formatted as a table and I have filters and a few pivot tables, but now my boss wants to see this data in a different summary format. For example, I have listed all our shipments details such as: vendor, customer, destination, shipping cost, , etc.; he wants to be able to just filter by customer name, or port, or vendor, and be able to get the high and low cost of shipping. I can do this by filtering the table, but I think he wants a format that he can use without all that other data. I am limited in my excel knowledge and don’t know how to create what he needs. I’ve researched, but while I see formulas that could help, I just don’t understand how to use them. Would you please help? I would really appreciate it. Thank you!

    Reply
  • Hi!
    I would like to capitalize the first three characters in a string of letters using excel. The characters will be different for each line. Is there a set of functions I can use?

    Reply
    • @TB. UPPER() will change text to uppercase. If A1 contained the text you wanted to change, you could use =UPPER(LEFT(A1,3))&RIGHT(A1,LEN(A1)-3)

      Reply
  • I have a column of data with an 10 digit date (xx-xx-xxxx) in the beginning of each data item. I would like to remove the date field and leave the rest of the data. The length of each data item is variable, but the longest is 60 characters.

    Reply
    • @Fred, To remove the first 10 characters using a formula, use =RIGHT(A1,LEN(A1)-10) assuming your data is in column A.

      Reply
  • I have a log where I would like the name column to automatically fill the adjoining column to the client’s location. I think this is a simple task, as I have seen it in other logs but I have no clue what function it is.

    Reply
  • I have a spread sheet, column shows.

    Last name, middle initial, first name or
    Last name, first name

    I need it to convert to, first name last name (no middle initial if there)

    I’ve tried many formulas and can’t get it right.

    Example:
    Report pulls:
    Smith A John
    Smith Jane

    Need:
    John Smith
    Jane Smith

    Reply
    • @Ash, You could try Flash Fill (Ctrl+e) to create columns for Last Name and First Name. If “Smith A John” is in cell A1, type “Smith” in cell B1 then press Ctrl+e. Then enter “John” in cell C1 and press Ctrl+e. Then enter =C1&” “&B1 into cell D1 and copy the formula down (or double-click on the fill handle). If Flash Fill doesn’t work for you, let me know and we’ll come up with a formula that works.

      Reply
  • I have an Excel spreadsheet and I have several Columns that include reviewer comments, formatted as follows:
    |Reviewer: *Review*| Reviewer: [No comments]| Reviewer :*Review*|
    i have this in multiple rows
    My question is, is there a way to filter and remove the Reviewers that have “[No Comments]” ?

    Reply
    • @DulanJay … Yes, using the Data > Filter tool, that should be pretty simple. [You should save a backup copy of your file before doing this.] First use the Filter tool to hide all the rows you do NOT want to delete. Then select the group of rows containing the rows you want to delete and press F5 or Ctrl+g to open the Go To window. Click on the Special button. Then select “Visible cells only”. Then right-click on one of the selected rows and select Delete Rows. Then clear your filter.

      Reply
  • I have a string of numbers that I need to have individually listed, one number per cell. Right now that string is being identified by have the smallest number in one cell and the largest in another. Instead of displaying like this I need to have the entire string of numbers to display. What is a formula that I can use to do this? Thanks in advance!

    Reply
    • @Michelle, can you provide an example? You mean you have something like 123456 and you need it to be split into 6 cells? Is it an actual number, or is it a text string? See tip #16 if the number is or can be converted to a text string first.

      Reply
      • John, thank you for your reply and my apologies for taking so long to respond! I actually already received an answer as I had put this request on several message boards so that I could ensure getting my project completed! But now that I know that you monitor this sight frequently I will save this to my favorite Excel message boards :D Thanks again!!!

        Reply
  • Cell Example:
    John Smith Capital Management, Chicago

    How can I change Chicago to be smaller font and italics and then reflect that format to all cells in the column? I know how to get the smaller font & italics in that cell, but I don’t know how to copy that format to the others.

    Reply
    • @Katie, It would be cool if Flash Fill could do that, but unless you are splitting the city out to a separate cell, I don’t think that’s going to work. When you copy formatting, Excel isn’t smart enough to apply italics and changes in font size and color within a portion of text to the correct places in other strings of text. Maybe someday Flash Fill will get to be that smart.

      Reply
  • Hello, my data currently exists as-
    Cell A1: Smith Family Denti
    Cell B1: stry 123 Main Street

    But it should be-
    Cell A1: Smith Family Dentistry
    Cell B1: 123 Main Street

    Looking for a formula to cut the “stry” at the start of cell B1 and move to another column that I can concatenate with cell A1 and also clean up the address in cell B1. I have 12000 rows of customer data. Some rows have this issue, some don’t. Some only have 1 character to cut out, some have more.

    Any help is much appreciated! I’ve spent a whole day Googling and trying different formulas that haven’t worked.

    Reply
    • @Brenda, The key in data cleanup is to identify patterns that you can detect and apply to the list as a whole. For example, if all street address should start with a number, then maybe you could use a formula in a helper column (or a conditional format rule) to identify all the addresses that start with a non-number. Something like =ISNUMBER(VALUE(LEFT(address,1))) might work. The VALUE function converts numbers into values for the ISNUMBER test. After that, you could filter based on the helper column or the formatting.

      Maybe a secondary helper column returns the location of the first space in the address via loc=FIND(” “,address). Then, with the combination of the two helper functions (meaning that you only do the next operations on the rows that really need it), you could use =LEFT(address,loc-1) to grab the text from the start of the address and concatenate it onto the name. And use =MID(address,loc+1,5000) to strip the address.

      Good luck!

      Reply
  • Column A    Column B       Column C
    Inv No.	    Project Code   

    How Can I get the answer on column B by using Excel Formula

    18JH42A330EN00710076	    A330	           ????
    18JH42A330EN00720077	    A330	           ????
    18JH44A330RT00720086	    A330	
    18CH2S011S0047	            S011	
    18JK2T007G0111	            T007	
    18TN2O004G0280	            O004	
    18PM080154WB0648	    PM08	
    18P055N0365WB117	    P055
    
    Reply
    • @Moidul. The answer to what? What do you want in Column C? If you mean how do you look up the project code based on the invoice number, that’s a VLOOKUP thing. =VLOOKUP(invoice_no,A:B,2,0)

      Reply
      • Thank you very much for your prompt reply, but if you please ignore the Project Code Column i.e Column B ( I have mention or the reference only) then by what formula I will pick up the project code from Column A only since in Column A the project code text string in different Nth Position. Can you help by any formula by selecting Column A only

        Reply
        • I see. You might have to take this to a data expert consultant. I can’t see any patterns in your data that would allow you to pull out the invoice number. If there is a pattern, then you could come up with a formula. Is there any way you can identify the part of the string that comes before and after the invoice number? If not, I don’t know how you’ll be able to pull the invoice number out of these seemingly random strings.

  • Thanks a lot for your prompt reply. Its my pleasure you reply my problem. Thanks once again

    Reply

Leave a Comment

Your Name will be displayed along with your comment. Your Email and IP address are stored with the comment and used to identify/prevent spam (via a service provided by Automattic.com), but are not shared publicly. See our privacy policy to learn more.

This site uses Akismet to reduce spam. Learn how your comment data is processed.