# Excel - IF Function Problem - Expert Solution

Question description:
This user has given permission to use the problem statement for this blog.

Trying to write a formula to pull all values from a cell that are LEFT of a hyphen "-", or all values if no hyphen
Solved by F. L. in 54 mins
This is the chat thread from the real Excelchat help session. It contains no private user information.
Excelchat Expert 02/02/2018 - 03:05
=LEFT(A5,FIND("-",A5)-1)
Excelchat Expert 02/02/2018 - 03:06
done
User 02/02/2018 - 03:07
so oddly enough...I'm putting it in my formuala...it doesn't error out, but almonst converts it to text?
Excelchat Expert 02/02/2018 - 03:07
hello
Excelchat Expert 02/02/2018 - 03:08
is it solved?
User 02/02/2018 - 03:08
no
User 02/02/2018 - 03:09
i'ved pasted the data i'm working with
User 02/02/2018 - 03:12
it's erroring out now
Excelchat Expert 02/02/2018 - 03:12
try this
Excelchat Expert 02/02/2018 - 03:12
=REPLACE(A2,1,FIND("-",A2),"")
User 02/02/2018 - 03:14
k
User 02/02/2018 - 03:21
the session says we r timing out...you are still working on it right?
Excelchat Expert 02/02/2018 - 03:21
yes i think i am done
User 02/02/2018 - 03:21
k
Excelchat Expert 02/02/2018 - 03:22
User 02/02/2018 - 03:23
the value is pulling right of the hyphen...need left
User 02/02/2018 - 03:23
rows 11, 13, 14, and 16 in what's showing is correct
User 02/02/2018 - 03:24
we just need an 'IF" statement on what it should do if it can't fine the "-"...then it should just pull the entire cell
Excelchat Expert 02/02/2018 - 03:24
ohk
Excelchat Expert 02/02/2018 - 03:37
Excelchat Expert 02/02/2018 - 03:37
done
Excelchat Expert 02/02/2018 - 03:37
please rate me at the end of session
Excelchat Expert 02/02/2018 - 03:38
User 02/02/2018 - 03:44
it's just pulling the full field value...not what's left of the hyphen
Excelchat Expert 02/02/2018 - 03:45
ohh sorry
Excelchat Expert 02/02/2018 - 03:52
=LEFT(A2,IFERROR(FIND("-",A2),999)-1)
Excelchat Expert 02/02/2018 - 03:52
Excelchat Expert 02/02/2018 - 03:54
done
User 02/02/2018 - 03:55
it's returning a 5 digit # in my doc...do I need to reformat the cell or something?
Excelchat Expert 02/02/2018 - 03:55
yes
Excelchat Expert 02/02/2018 - 03:55
but my formula is working 100%
Excelchat Expert 02/02/2018 - 03:55
returning output as you desire?
User 02/02/2018 - 03:56
i'm still getting numbers...
Excelchat Expert 02/02/2018 - 03:56
what number?
User 02/02/2018 - 03:57
I just figured it out...wrong cell reference
User 02/02/2018 - 03:57
yay!!!!
User 02/02/2018 - 03:57
finished!!!!
User 02/02/2018 - 03:57
amazing!!!
User 02/02/2018 - 03:57
thank you!!!
Excelchat Expert 02/02/2018 - 03:57
yes please rate me before ending session
Excelchat Expert 02/02/2018 - 03:57
User 02/02/2018 - 03:57
where is the rating button
Excelchat Expert 02/02/2018 - 03:58
after ending session
User 02/02/2018 - 03:58
k
Excelchat Expert 02/02/2018 - 03:58
you will see

This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user information.

Get instant expert help with Excel and Google Sheets

#### Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Your privacy is guaranteed. Your session will not be used for blog unless you give us persmission.