How do get rid of characters on the right hand side of a cell??

dkflameboy

New Member
Joined
Nov 28, 2016
Messages
22
Office Version
  1. 365
Help, I have many, many cells that have a date and time in them like this

02.08.2018 - 10am

I want to remove the - 10am section

How do I do this please?
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Give us a few more examples.

Would the last character you want always be 8

And where are the dates?

Are they always in column 1 ?
 
Upvote 0
Yes, the last character will always be 8, in the infinite wisdom of some, they have entered the date as a free text field either using the full 2018 or 18.

They are all in the format of either 02.08.2018 or 02.08.18 (although the day and month vary on each cell, and there are 250 plus of them)

They are all in column I first one starting at I2.
 
Upvote 0
It depends on why that is what you are seeing ..... it's possible that the cells are formatted to appear like that, in which case simply change the formatting.

If the cells are textual and contain the time you might want to look at how they are generated and alter that.

If it is data that arrives in that format then you could fix it with a macro that does something like:

range("a1").value = left(range("a1").value, 10)

obviously the range "a1" needs to be different
 
Upvote 0
Ah this might be better.


Code:
Dim iI As Integer
For Each c In Range("i2:i999")
If c.Value <> "" Then
    iI = InStr(1, c.Value, "-", 1)
    c.Value = Left(c.Value, iI - 2)
End If
Next c
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,215
Members
448,554
Latest member
Gleisner2

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