Separate the number into a column and remove the yes no

philky001

Board Regular
Joined
Jun 8, 2005
Messages
129
I have an excel sheet with only one column like this:
Col A
1201NSNYC-Brooklyn Group HHCyes
1202NSNYC-Brooklyn Office HHCCyes

I would like to run a formula on the dataset that would separate for me the 1201 all rows start out with such a number.
So that the new column would contain 1201 and it would delete itself from the original col. also if we can delete the yes at the end (sometimes it is no ) but mostly is yes so it can
be done just for yes. Thank you for your help.
The result after the formula runs is:

Col A Col B
1201 NSNYC-Brooklyn Group HHC
1202 1202NSNYC-Brooklyn Office HHCC
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Upvote 0
Are you looking for a manual way to do this, or VBA?

If the number to be separated is always exactly 4 characters long, you can easily separate it using "Text To Columns", choosing the Fixed Width (space delimited) option, and making the split right after character 4.

We can use formulas to remove the "yes" or "no" off the end of records (using IF and RIGHT functions).
 
Upvote 0
Sorry this is clearer
I have an excel sheet with only one column like this:

Col A

1201NSNYC-Brooklyn Group HHCyes

1202NSNYC-Brooklyn Office HHCyes


I would like to run a formula on the dataset that would separate for me the 1201, 1202 all rows start out with such a number. the first 4 characters will always start with such a number.

So that the new column would contain 1201, or 1202 and it would delete itself from the original col. also if we can delete the yes at the end (sometimes it is no ) but mostly is yes so it can

be done just for yes. Thank you for your help.

The result after the formula runs is:



Col A Col B

1201 NSNYC-Brooklyn Group HHC

1202 NSNYC-Brooklyn Office HHC
 
Upvote 0
Are you looking for a manual way to do this, or VBA?

If the number to be separated is always exactly 4 characters long, you can easily separate it using "Text To Columns", choosing the Fixed Width (space delimited) option, and making the split right after character 4.

We can use formulas to remove the "yes" or "no" off the end of records (using IF and RIGHT functions).
Manual or VBA. It will always start with a 4 digit number.
 
Upvote 0
Have you tried the formulae I suggested?
 
Upvote 0
=SUBSTITUTE(SUBSTITUTE(MID(A2,5,100),"yes",""),"no","")
Fluff,
I see a potential problem with that formula. And that is if the text contains the letters "yes" and "no" before the end, like a city name like "Reno", it is going to mess it up.
Which is why I was thinking we might need to use the RIGHT function to make sure we are just checking the last 2 or 3 letters.
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Try:

Select your A COL click on Data at the top, click on "text to Column" in the Text to columns wizard select fixed width, Next. move the Vertical line over between the numbers and "NSNCY" click Finish

Then use this formula in column C
Excel Formula:
=LEFT(B1,SEARCH("YES",B1)-1)
drag it down. copy column C and paste as value and remove column B

hope this helps
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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