## Extract first word in cell

The formula in cell C3 grabs the first word in B3 using a blank as the delimiting character.

The SEARCH function looks for a "space" character in cell B3 and returns 7, if you want to use a different delimiting character change the first argument in the SEARCH function.

We don't need the space character so we subtract the number returned from the SEARCH function with 1.

The LEFT function then extracts the first word in cell B3 using the calculated number.

The following formula warns if the delimiting character is not found.

The SEARCH function returns #VALUE error if the delimiting character is not found. The COUNT function counts how many numbers are in a cell or cell range, it also ignores errors which come handy in this case.

The COUNT function returns 0 (zero) in cell B3 and the IF function interprets that as a FALSE. The third argument in the IF function is returned "Wrong delimiting character?".

### Download Excel *.xlsx file

The array formula in cell C3 extracts the first character from first, middle and last name. The formula works fine [โฆ]

Chirag asks: I want to separate numbers from the following text: Abc123bx45 as a result 123 and 45 should be [โฆ]

Extract table headers based on a condition

This article demonstrates an array formula that returns the table header based on a condition. For example, in cell C8 [โฆ]

How to extract numbers from a cell value

The following array formula, demonstrated in cell C3, extracts all numbers from a cell value: =TEXTJOIN(, 1, TEXT(MID(B3, ROW($A$1:INDEX($A$1:$A$1000, LEN(B3))), [โฆ]

The LEFT function allows you to extract a string from a cell with a specific number of characters, however, if [โฆ]

Sum cells containing numbers and text based on a condition

Question: I want to sum cells that have a "C" and a decimal number. The cells have other numbers and [โฆ]

The LEFT function extracts a specific number of characters always starting from the left. Excel Function Syntax LEFT(text, [num_chars]) Arguments [โฆ]

### 2 Responses to โExtract first word in cellโ

### Leave a Reply

### How to comment

**How to add a formula to your comment**

<code>Insert your formula here.</code>

**Convert less than and larger than signs**

Use html character entities instead of less than and larger than signs.

< becomes < and > becomes >

**How to add VBA code to your comment**

[vb 1="vbnet" language=","]

Put your VBA code here.

[/vb]

**How to add a picture to your comment:**

Upload picture to postimage.org or imgur

Paste image link to your comment.

**Contact Oscar**

You can contact me through this contact form

Good article. Often, I need to select up to a delimiter character or the whole cell contents, whichever is applicable.

Suppose cell A2 = "ABC|DEF", cell A3 = "Words". And, in this case, my delimiter is the vertical bar or pipe character "|".

`=left(A2,search("|",A2 & "|")-1)`

For cell A2, I append a vertical bar, so what I'm searching is actually the string "ABC|DEF|". The search will still find the first vertical bar (position 4) and then subtract 1 for the left function, producing "ABC".

If we used cell A3 instead of A2, appending the vertical bar to the string "Words" would give us "Words|". The position returned by the search function is 6, and subtracting 1 from this (now 5) gives us the length of the string, so the left function gets the original string.

Whether you use this approach or not is largely dependent upon what you're trying to produce. This covers most of my use cases, and when I discovered it, it simplified lots of my coding (SQL and Excel for sure).

Thank you Jack for your comment.

Very useful if a cell does not contain the specified delimiting character at all.

=LEFT(B3,SEARCH(" ",B3&" ")-1)