# Error Extracting first name from cell if only 1 name

1. ## Error Extracting first name from cell if only 1 name

I'm trying to extract the first name from each row in column a using:

Formula:
`Please Login or Register  to view this content.`

 A B Joe Smith Joe Julie Smith Julie Julie #VALUE!

If the cell does not have 2 names it's giving me an error. Any help with how I could correct this is greatly appreciated. Thanks

2. ## Re: Error Extracting first name from cell if only 1 name

Try this version

=LEFT(A2,FIND(" ",A2&" ")-1)

3. ## Re: Error Extracting first name from cell if only 1 name

Try this version

=LEFT(A2,FIND(" ",A2&" ")-1)
Thank you, this corrected my issue.

4. ## Re: Error Extracting first name from cell if only 1 name

I apologize, I have one more question regarding this. If I wanted to do the opposite (Extract the second name only) with my table. How would the formula be setup so it would only show the second name. And if there is no second name the cell is empty. Thank you again.

5. ## Re: Error Extracting first name from cell if only 1 name

=if(iserror(right(a2,len(a2)-search(" ",a2,1))),"",right(a2,len(a2)-search(" ",a2,1)))

6. ## Re: Error Extracting first name from cell if only 1 name

Try this version

=IFERROR(REPLACE(A2,1,FIND(" ",A2),""),"")

7. ## Re: Error Extracting first name from cell if only 1 name

Originally Posted by azumi
=if(iserror(right(a2,len(a2)-search(" ",a2,1))),"",right(a2,len(a2)-search(" ",a2,1)))
Thank you very much, this works perfect.

8. ## Re: Error Extracting first name from cell if only 1 name

or this slightly shorter option...
=IF(ISNUMBER(SEARCH(" ",A1,1)),MID(A1,SEARCH(" ",A1,1)+1,99),"")

9. ## Re: Error Extracting first name from cell if only 1 name

hi dominick. yet another alternative:
=IFERROR(MID(A2,FIND(" ",A2)+1,LEN(A2)),"")

10. ## Re: Error Extracting first name from cell if only 1 name

=iferror(substitute(a2,left(a2,find(" ",a2)),""),"")

11. ## Re: Error Extracting first name from cell if only 1 name

Also:
=TRIM(MID(A2&" ",FIND(" ",A2&" "),255))

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1