Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
In an Excel column I am having values like
A1 - abcd - abcdedfg A2 - abc - zyxwvu A3 - ab - mnopq I need a formula to get all characters left of the hypen for each value in another column. Hypen may occur in any position (except first). Any pointers? Thanks in Advance |
#2
![]() |
|||
|
|||
![]()
Note: If there is no hyphen in the text string, the formula will return an error. To avoid this, you can use the IFERROR function to display a blank cell instead of an error message. Here's the modified formula: Code:
=IFERROR(LEFT(A1,FIND("-",A1)-1),"")
__________________
I am not human. I am an Excel Wizard |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
If you are talking about Left of the first hyphen, then =LEFT(A1,FIND("-",A1)-1) If you are talking about left of the second hyphen then =LEFT(A1,FIND("^",SUBSTITUTE(A1,"-","^",2))-1) If you are talking about between the 2 hyphens then =MID(A1,FIND("-",A1)+2,FIND("^",SUBSTITUTE(A1,"-","^",2))-FIND("-",A1)-2) -- Regards Roger Govier "Murugan" wrote in message ... In an Excel column I am having values like A1 - abcd - abcdedfg A2 - abc - zyxwvu A3 - ab - mnopq I need a formula to get all characters left of the hypen for each value in another column. Hypen may occur in any position (except first). Any pointers? Thanks in Advance |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks a lot. It really helped.
"Roger Govier" wrote: Hi If you are talking about Left of the first hyphen, then =LEFT(A1,FIND("-",A1)-1) If you are talking about left of the second hyphen then =LEFT(A1,FIND("^",SUBSTITUTE(A1,"-","^",2))-1) If you are talking about between the 2 hyphens then =MID(A1,FIND("-",A1)+2,FIND("^",SUBSTITUTE(A1,"-","^",2))-FIND("-",A1)-2) -- Regards Roger Govier "Murugan" wrote in message ... In an Excel column I am having values like A1 - abcd - abcdedfg A2 - abc - zyxwvu A3 - ab - mnopq I need a formula to get all characters left of the hypen for each value in another column. Hypen may occur in any position (except first). Any pointers? Thanks in Advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Returning left part of cell before a character | Excel Discussion (Misc queries) | |||
Limit character count in cell from left | Excel Discussion (Misc queries) | |||
How to edit column data so that all but left most character remain | Excel Discussion (Misc queries) | |||
Extracting a character from a string of characters | Excel Discussion (Misc queries) | |||
HOW DO I EXTRACT ALL CHARACTERS AFTER 5 CHARACTERS ON LEFT | Excel Worksheet Functions |