Time Calculation From String

nigelk

Well-known Member
Joined
Aug 30, 2008
Messages
537
Hi all,

I've extracted a time from a string i.e, 14:10

and am trying to calculate how many hours/minutes to go from the current time,
so it would 14:10- 13:30, which should equal 40, but an having real problems.

Can anyone help?

Thanks,Nigel
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi all,

I've extracted a time from a string i.e, 14:10

and am trying to calculate how many hours/minutes to go from the current time,
so it would 14:10- 13:30, which should equal 40, but an having real problems.

Can anyone help?

Thanks,Nigel

What was the string? And what kind of problems are you having?
 
Upvote 0
I've set them both to custom format hh:mm, but as one time is extracted from a string, and the other from a formula :Now(), I'm not sure this is right?
 
Upvote 0
If you have 14:10 in A1 then you could try

=A1-MOD(NOW(),1)

format result cell as h:mm

If the current time is 13:30 then that will give a result of 0:40.....but what would you want to see if the current time is 14:30?
 
Upvote 0
Ive just tried this on a sheet and it is not the string that is the problem it is the now() part of the function this generates ### and whenI hover over it it states negative numbers that are too large show as ####

dont know the answer but it is the NOW() at fault
 
Upvote 0
Hi Barry,

If the meeting time is the same as Now(), I would like the result to be 0

(I'd really like to be: "You're late, you're sacked!"), but as it's my boss..........

Thanks,Nigel
 
Upvote 0
The string is "Meeting: 14:10"

Perhaps something like...

Let A2 house the string.

B2, formatted as h:mm

=REPLACE(A2,1,FIND(" ",A2),"")+0

C2, formatted as h:mm

=MOD(NOW(),1)

D2:

=IF(B2>=C2,"Time to meeting; "&TEXT(B2-C2,"h:mm"),"Late for: "&TEXT(C2-B2,"h:mm"))
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,239
Members
452,898
Latest member
Capolavoro009

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