ADJUST "LEFT(FIND" IN FORMULA TO RETURN TEXT BEFORE THE 1ST SPACE

JuicyMusic

Board Regular
Joined
Jun 13, 2020
Messages
210
Office Version
  1. 365
Platform
  1. Windows
Hi, I've tried to adjust this formula with no success.

There will always be a space, then a dash, then another space directly after the job number (9729BN)
I need the formula in column L to return only the job number - not the job number AND the space directly after it.

Here is my text string: 9729BN - Pacific Auto Recycling Center

Here is my formula:
Excel Formula:
=IF(OR(C2,"*DUMMY*",C2=""),"",
LEFT(C2,FIND(" ",C2)-1))


Thanks you so much
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
In what way doesn't it work?
 
Upvote 0
If there is not a space after the job number - the formula returns a #Value.
I actually have to add a space after the last letter in the job number.
 
Upvote 0
=IF(OR(C2,"*DUMMY*",C2=""),"",
LEFT(C2,FIND(" ",C2)-1))

Also, can you explain in words what the red part of the formula is trying to do?
 
Upvote 0
Hello, thank you for responding.

I received a monthly export from our system.
The number of rows varies but could be in the hundreds.
Occasionally there are cells in Column B that are blank (out of 500 rows there could be only 3 cells that are blank)
I will have to manually enter the job number (example: 9729BN or 8123A) (the letters at the end are the Managers initials and could be 1 or more letters)

DUMMY: When the IT department tests something - there will be the word DUMMY - and the formula will return a #Value which is just fine.

The issue is that when I manually enter a job number in the blank cell in Column B - the formula in col L requires me to add a space so that it returns the job number.

The yellow highlighted row is what i manually entered to show you the result in column L. Thank you!!!
 

Attachments

  • Capture_space after manualy entry.PNG
    Capture_space after manualy entry.PNG
    19.5 KB · Views: 9
Upvote 0
Ok, how about
Excel Formula:
=LEFT(C2,FIND(" ",C2&" ")-1)
then you can filter out the cells that return "Dummy"
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top