Home > OS >  VBA convert time on Number
VBA convert time on Number

Time:12-29

I need to convert my time to Number. i need it because letter i'm going to divide this dates by yourself to calculate % (agent productive time ).

I tried something like this

'cells(2,3) = 22:12:2

cells(2,3) / (60*60*1000)

Thanks in advance

CodePudding user response:

You can do like this:

a = "78:19:41"
b = "74:23:58"
ta = (Split(a, ":")(0) / 24)   TimeValue("00:" & Split(a, ":", 2)(1))
tb = (Split(b, ":")(0) / 24)   TimeValue("00:" & Split(b, ":", 2)(1))

p = tb / ta * 100
p -> 94.9844138434859 
  • Related