excel - How to remove the last charactor and replace `:` by `.` -


i have 2 columns m , u containing employee time record in excel sheet time format wrong 08:13a. want 08.13 in order use subtraction formula =u2-m2 difference. want replace : . , ride of last character using excel vba.

if 8:13a 8 hours, 13 minutes, running:

sub timefixer()     each r in selection         ary = split(mid(r.text, 1, len(r.text) - 1), ":")         r.value = timeserial(ary(0), ary(1), 0)         r.numberformat = "hh:mm:ss"     next r end sub 

will produce time can use numerically.

edit#1:

formula:

=timevalue(left(a1,len(a1)-1)) 

for example:

enter image description here

or in code replace selection range("a1:a100")

there many ways skin cat.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -