Deleting Last 8 Characters From A String (Difficulty w/ Formatting)

ssshah

New Member
Joined
Jun 9, 2011
Messages
8
Hi Everybody,

I've gone through multiple forums and exhausted Google search for this question. I often find that deleting the last x characters is no problem, but I have a formatting issue with my data.

Version: Excel 2010
OS: Windows XP

I want to go through column B and delete the last 8 characters in the string if they contain " x". Where x can be any single digit number. There are 7 spaces in that blank spot before x. It is quite cumbersome to go through all the iterations for find & replace is there a more intelligent way to do this via macro? I'd like to also make a note that the cells without " x" the formatting is tricky to deal with because if put into text form it displays as a number between 0 and 1 (ex. 0.583). So I want to remove the last 8 digits & correctly format the time if " x" exists.

I don't think I can upload the file here, so please private message me if you can help! Or if you don't need the file post here!


Example of file

HTML:
13:15       1
13:30
13:45
14:00
14:15
14:30       7
14:45       3

Oh I used HTML code but its only to highlight the example.

Thanks in advance

-ssshah
 
Last edited:

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Works perfectly, I have to still get around the formatting but that I can do. Thank you so much for your help!
 
Upvote 0
Glad to help, thansk for the feedback.

Yes, you just have to format the cell with the formula as Number.

You can also try using
Data - Text To Columns - Deliminated - Space
Make sure to check "treat consecutive delimiters as one"
 
Upvote 0
...You can also try using
Data - Text To Columns - Deliminated - Space
Make sure to check "treat consecutive delimiters as one"

Actually, I was going to suggest the Text to Columns tool as well, but using fixed width (if the times are all HH:MM formatted) and then just picking "Skip" for the 2<SUP>nd</SUP> column.
 
Upvote 0

Forum statistics

Threads
1,224,567
Messages
6,179,571
Members
452,927
Latest member
whitfieldcraig

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