Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formula to calculate time

In my spreadsheet, I have column A defined as format "time". There, I
insert values like:

0:00
13:20
7:30

etc.

In column B I have the formulae:

=A1+8.5
=A2+8.5

etc. (I want to add 8 1/2 hours to the start time.)

However, I'm not getting what I would expect. I would expect to see:

0:00 8:30
13:20 23:50
7:30 16:00

But instead I'm seeing:

0:00 12:00
13:20 1:20
7:30 19:30


What am I doing wrong?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default Formula to calculate time

=A1+(8.5/24)

Time in Excel is stored as a fraction of a day

--
Kind regards,

Niek Otten

Microsoft MVP - Excel

"accelerator" wrote in message
oups.com...
In my spreadsheet, I have column A defined as format "time". There, I
insert values like:

0:00
13:20
7:30

etc.

In column B I have the formulae:

=A1+8.5
=A2+8.5

etc. (I want to add 8 1/2 hours to the start time.)

However, I'm not getting what I would expect. I would expect to see:

0:00 8:30
13:20 23:50
7:30 16:00

But instead I'm seeing:

0:00 12:00
13:20 1:20
7:30 19:30


What am I doing wrong?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formula to calculate time

Thanks! I wish I could have found that easily in the help (some
examples would be nice)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Formula to calculate time

Hi accelerator,
Try this site out.
http://www.cpearson.com/excel/datearith.htm
This does work for sure.
Terry

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formula to calculate time

I also noticed, that although I set the format to UTC (e.g. 13:30),
when I enter 12:00 it assumes that it is midnight and not mid-day.
When I enter 12:00 it displays 0:00!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula to calculate time

an alternative is to add a time value

=A1+Timevalue("8:30")

--
Regards,
Tom Ogilvy

"accelerator" wrote in message
oups.com...
In my spreadsheet, I have column A defined as format "time". There, I
insert values like:

0:00
13:20
7:30

etc.

In column B I have the formulae:

=A1+8.5
=A2+8.5

etc. (I want to add 8 1/2 hours to the start time.)

However, I'm not getting what I would expect. I would expect to see:

0:00 8:30
13:20 23:50
7:30 16:00

But instead I'm seeing:

0:00 12:00
13:20 1:20
7:30 19:30


What am I doing wrong?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formula to calculate time

I couldn't duplicate that behavior in xl2003. In tools
=Options=Transition, do you have anything selected in the checkboxes on
that dialog. If so, try unchecking them.

--
Regards,
Tom Ogilvy


"accelerator" wrote in message
oups.com...
I also noticed, that although I set the format to UTC (e.g. 13:30),
when I enter 12:00 it assumes that it is midnight and not mid-day.
When I enter 12:00 it displays 0:00!



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formula to calculate time

OK -- Now how can I place a date in a cell as text but with a specific
format?

e.g.

cell a1, formatted as date, currently displays 21/10/05

I want to place (via vba) this date as text in cell a2, but I want it
to look like

21 Oct 2005

or

October 21, 2005

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Formula to calculate time

try this

With Range("a1")
..NumberFormat = "MMMM DD, YYYY"
End With

--


Gary


"accelerator" wrote in message
oups.com...
OK -- Now how can I place a date in a cell as text but with a specific
format?

e.g.

cell a1, formatted as date, currently displays 21/10/05

I want to place (via vba) this date as text in cell a2, but I want it
to look like

21 Oct 2005

or

October 21, 2005



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Formula to calculate time

That didn't do it. I used the code:

Sub test()
Range("b1") = Range("a1").Value
With Range("b1")
..NumberFormat = "MMMM DD, YYYY"
End With

but when I changed the format of the cell to text, I see:

38646


How can I convert the date to the above format, then copy the results,
*as text*, to another cell, formatted as text?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How calculate end time with beginning time plus formula minutes Calculate an ending time Excel Worksheet Functions 3 April 4th 23 02:30 PM
Formula Calculate after a certain time of day. David Biddulph[_2_] Excel Discussion (Misc queries) 1 October 17th 08 11:23 PM
Formula to calculate over-time Debbie Mack Excel Discussion (Misc queries) 1 September 16th 05 08:37 PM
Formula to calculate time Paul (ESI) Excel Discussion (Misc queries) 6 August 12th 05 05:46 PM
How do I set up a formula on a time sheet to calculate time in 1/. gschmid Excel Discussion (Misc queries) 2 January 18th 05 01:48 PM


All times are GMT +1. The time now is 03:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"