点击插页>模块,然后将以下代码粘贴到模块窗口。 FunctionFindWord(SourceAsString,PositionAsInteger)'Update 20131202Dimarr()AsStringarr=VBA.Split(Source," ")xCount=UBound(arr)IfxCount<1Or(Position-1)>xCountOrPosition<0ThenFindWord=""ElseFindWord=arr(Position-1)EndIfEndFunction Copy 3。 然后保存代码,...
Learn how to quickly extract first, last or Nth word from a string in Excel leaving complex formulas behind. Simple and accurate solutions to get a word containing a specific character, text after word, with custom delimiter, and more.
Extract first word or last name from text string with Formulas If you need to extract the first word from a list of text strings, the following formulas can help you. To extract the first word, please enter below formula into a blank cell, and then drag this cell's AutoFill handle to...
When the formula finds the position of the space character, the LEFT function is used to extract all the characters before that first space character in the text string. While the LEFT formula alone should be enough, it will give you an error in case there is only one word in the cell ...
Read More: How to Extract Text After First Space in Excel Method 4 – Combining RIGHT, SEARCH, and SUBSTITUTE Functions to Extract Specific Characters Steps Use the following formula in Cell D5: =RIGHT(B5,LEN(B5)-SEARCH("#",SUBSTITUTE(B5,C5,"#",LEN(B5)-LEN(SUBSTITUTE(B5,C5,"")))...
For example, if the last and first names are separated by a comma and a space, use the string ", " fordelimiter: =TEXTAFTER(A2, ", ") Excel formula: extract text after word In Excel terms, a "word" is nothing else but a "substring". So, to copy text after a specific word int...
In our example, column A contains the full names. However, the last names are first, with a comma and a spaceseparating the first and last name. Here are the steps needed to extract the first name using the TEXTAFTER Function: Use the following formula in cell B2 and then press Enter:...
\n \n Use ““ (space) as a delimiter with TEXTBEFORE to extract the first name and TEXTAFTER to extract the last name \n Use TEXTSPLIT to separate the names into an array with ““ (space) as a delimiter \n\n\n When you want to combine two ranges of data: \n...
For more information on question you can click on this link:Extract Last Word Following is the snapshot of preferred output data: We will find the same solution with different formulas. Let us first find the solution using array. This formula has the combination of TRIM, RIGHT, LEN, MAX, ...
Step 2: Extract the text after the first delimiter (last names in this case) Select a cell (D2 in this case) to output the last name, enter the following formula and pressEnterto get the last name in A2. =RIGHT(A2,LEN(A2)-SEARCH(" ",A2)) ...