Proper Formula For COnverting Text Time To Decimal

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I don't think I'm on the right course for converting my text timne values to that time's decimal equivalent.

Code:
pgm_start = (TimeValue(uf8_post.uf8_d_start.Caption) / 24)
pgm_end = (TimeValue(uf8_post.uf8_d_end.Caption) / 24)

uf8_d_start and uf8_d_end are text boxes in userf orm uf8_post. They hold time values in text format.

uf8_d_start = "6:00 PM"
uf8_d_end = "8:00 PM"

After the formulae,

pgm_start = 0.03125
pgm_end = 3.47222222222222E-2

I don't think I am using the right formula as these answers don't look right.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Oh, I have it partially figured out. It should by * 24 not / 24.
 
Upvote 0
format(Timevalue("6:00 PM"),"0.00") will return 0.75 (the time as a fraction of a day)
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,249
Members
449,075
Latest member
staticfluids

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