Time in Excel

I have a legacy spreadsheet that deals with times.  We have values like
min:sec and use 12:00:00 AM in the cell for 00:00  To input a time, I
need to edit the cell.  Is there a way to go to a cell and type "656"
and get 06:56?

Also, I'd like a way to average several cells containing times as above.
What function would I use for that?

-- 
John Oliver, CCNA                            http://www.john-oliver.net/
Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
***               sendmail, Apache, ftp, DNS, spam filtering         ***
****                Colocation, T1s, web/email/ftp hosting          ****
0
joliver (24)
7/25/2003 2:32:10 AM
excel.misc 78881 articles. 5 followers. Follow

5 Replies
425 Views

Similar Articles

[PageSpeed] 17

John,

To do the first, that is modify the input to time, requires VBA. A worksheet
event code like

Private Sub Worksheet_Change(ByVal Target As Range)

    Application.EnableEvents = False
    On Error GoTo ws_exit
    If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
        If Target.Count = 1 Then
            Target.Value = TimeSerial(Target \ 100, Target - ((Target \ 100)
* 100), 0)
        End If
    End If

ws_exit:
    Application.EnableEvents = True
End Sub

which will modify cells A1:A10.

To average time, just use the average function, and make sure the cell is
formatted as time, and you don't put it in the range being changed.

--
    HTH

    -------

    Bob Phillips
    ... looking out across Poole Harbour to the Purbecks


"John Oliver" <joliver@john-oliver.net> wrote in message
news:slrnbi15l4.7rf.joliver@ns.sdsitehosting.net...
> I have a legacy spreadsheet that deals with times.  We have values like
> min:sec and use 12:00:00 AM in the cell for 00:00  To input a time, I
> need to edit the cell.  Is there a way to go to a cell and type "656"
> and get 06:56?
>
> Also, I'd like a way to average several cells containing times as above.
> What function would I use for that?
>
> --
> John Oliver, CCNA                            http://www.john-oliver.net/
> Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
> ***               sendmail, Apache, ftp, DNS, spam filtering         ***
> ****                Colocation, T1s, web/email/ftp hosting          ****


0
bob.phillips (411)
7/25/2003 7:11:36 AM
On Fri, 25 Jul 2003 08:11:36 +0100, Bob Phillips wrote:
> John,
> 
> To do the first, that is modify the input to time, requires VBA. A worksheet
> event code like
> 
> Private Sub Worksheet_Change(ByVal Target As Range)
> 
>     Application.EnableEvents = False
>     On Error GoTo ws_exit
>     If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
>         If Target.Count = 1 Then
>             Target.Value = TimeSerial(Target \ 100, Target - ((Target \ 100)
> * 100), 0)
>         End If
>     End If
> 
> ws_exit:
>     Application.EnableEvents = True
> End Sub
> 
> which will modify cells A1:A10.

Thanks.  Being an almost complete Excel newb, though, I gotta ask... how
do I put in that VBA code? :-)

> To average time, just use the average function, and make sure the cell is
> formatted as time, and you don't put it in the range being changed.

I had tried a couple of combinations of:

=AVERAGE(F4:F22)

But keep getting  #NAME?

-- 
John Oliver, CCNA                            http://www.john-oliver.net/
Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
***               sendmail, Apache, ftp, DNS, spam filtering         ***
****                Colocation, T1s, web/email/ftp hosting          ****
0
joliver (24)
7/25/2003 5:49:42 PM
John,

To input the code
- on the sheet you want it to apply to
- right-click the sheet tab
- on this menu, select View Code
- you should now be in the worksheet code module, so in the code pane just
copy the code I gave you
- test it by putting a value in A1

Re AVERAGE, the error you are getting sounds like the function is wrongly
entered. For instance, if you put =AVRAGE(A1:A22) you would get that error.
Otherwise I am stumped.

--
    HTH

    -------

    Bob Phillips
    ... looking out across Poole Harbour to the Purbecks


"John Oliver" <joliver@john-oliver.net> wrote in message
news:slrnbi2rdj.8sv.joliver@ns.sdsitehosting.net...
> On Fri, 25 Jul 2003 08:11:36 +0100, Bob Phillips wrote:
> > John,
> >
> > To do the first, that is modify the input to time, requires VBA. A
worksheet
> > event code like
> >
> > Private Sub Worksheet_Change(ByVal Target As Range)
> >
> >     Application.EnableEvents = False
> >     On Error GoTo ws_exit
> >     If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
> >         If Target.Count = 1 Then
> >             Target.Value = TimeSerial(Target \ 100, Target - ((Target \
100)
> > * 100), 0)
> >         End If
> >     End If
> >
> > ws_exit:
> >     Application.EnableEvents = True
> > End Sub
> >
> > which will modify cells A1:A10.
>
> Thanks.  Being an almost complete Excel newb, though, I gotta ask... how
> do I put in that VBA code? :-)
>
> > To average time, just use the average function, and make sure the cell
is
> > formatted as time, and you don't put it in the range being changed.
>
> I had tried a couple of combinations of:
>
> =AVERAGE(F4:F22)
>
> But keep getting  #NAME?
>
> --
> John Oliver, CCNA                            http://www.john-oliver.net/
> Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
> ***               sendmail, Apache, ftp, DNS, spam filtering         ***
> ****                Colocation, T1s, web/email/ftp hosting          ****


0
bob.phillips (411)
7/25/2003 6:02:15 PM
On Fri, 25 Jul 2003 19:02:15 +0100, Bob Phillips wrote:
> John,
> 
> To input the code
> - on the sheet you want it to apply to
> - right-click the sheet tab
> - on this menu, select View Code
> - you should now be in the worksheet code module, so in the code pane just
> copy the code I gave you
> - test it by putting a value in A1

Ahh! :-)

Two other questions...

A) "101" results in 1:01:00  I'd like it to result in 1:01

B) I want this to work with more than one range of cells.  I'm not sure
how to properly specify more than one range.

Thanks so much!

-- 
John Oliver, CCNA                            http://www.john-oliver.net/
Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
***               sendmail, Apache, ftp, DNS, spam filtering         ***
****                Colocation, T1s, web/email/ftp hosting          ****
0
joliver (24)
7/25/2003 6:11:55 PM
On 25 Jul 2003 18:11:55 GMT, John Oliver wrote:
> A) "101" results in 1:01:00  I'd like it to result in 1:01

To be more precise, minutes and seconds.  Unless I type, say, 12345,
which would be 1:23:45

> B) I want this to work with more than one range of cells.  I'm not sure
> how to properly specify more than one range.

I stumbled on how to do this... I used Range("E4:E27", "F4:F27")

-- 
John Oliver, CCNA                            http://www.john-oliver.net/
Linux/UNIX/network consulting         http://www.john-oliver.net/resume/
***               sendmail, Apache, ftp, DNS, spam filtering         ***
****                Colocation, T1s, web/email/ftp hosting          ****
0
joliver (24)
7/25/2003 6:29:30 PM
Reply:

Similar Artilces:

number rounding in MS Excel
Hi, This may have been answered many times. In MS EXCEL is there a way that it calculates all numbers to 2 decimal digit accuracy instead of the 15 digit default? Thanks in advance for the answer. Hi You can set your decimal places in your cells as 2 and then check Precision As Displayed on the Tools / Options / Calculation page. Be careful though, it means what it says!! -- Andy. "mahusain" <abidh@bdnet.net> wrote in message news:ab59c6f6.0404200315.5196e8aa@posting.google.com... > Hi, > > This may have been answered many times. > > In MS EXCEL is ther...

SpreadSheetML (XML for Excel)
Hello All, A client of mine has Office X for Mac. I am wondering if this edition of Excel supports SpreadSheetML. I have heard that it also support the new Open XML formats (same as Office 11). Does anyone know if either of these statements is accurate? Thanks in advance, -KJ Hi KJ: I believe that both statements are wrong. The XML converter for Office Next on the Mac has not yet been developed. It's not likely to come until after the PC Office team ships their product to retail -- until they stop CHANGING the thing :-) My guess is that the converter won't appear until sometime...

Public Folder link to Excel File
Hi - I have a user that claims that he had a shortcut to a spreadsheet "in his public folders" at his old job. Obviously, he's an end user that may or may not know what he's talking about.... I'm trying to figure out the best way to accomodate him. He basically wants an Excel file stored on a shared folder to be available to all user as either a shortcut, or a link in the public folders (can't post to a folder as he will be updating the sheet regularly). When a user clicks on the shortcut/link, it would just launch Excel and display the file. Anybody have any ideas...

Filters in Excel 2003
I am using Filters in Excel 2003. Every cell in sheet B is linked to every cell in sheet A. That way I can alter data in B without corrupting the original data in A. I then highlight the cells in B that I want to assign a filter to and select Advanced Filter. I have no criteria so I do not set that. I click OK. I then select Filter again and this time select Auto Filter. Drop down arrows appear at the top of my columns. Great, no problems so far, I then select from the drop down list the criteria that I want to filter. Again no problems, my list filters correctly. But once I have do...

Excel Opens Without Displaying Workbook
I am having issues with opening an Excel file. The file opens, but the workbook is not displayed. I tried the resolution in the article XL97: Excel Opens Without Displaying Workbook (http://support.microsoft.com/default.aspx?scid=kb;en-us;158996&Product=xlw97), but neither of the resolutions fixed the problem. Any suggestions?? Are you using Excel 97? -John Baughman Fort Collins, CO >-----Original Message----- >I am having issues with opening an Excel file. The file opens, but the workbook is not displayed. I tried the resolution in the article XL97: Excel Opens Without Di...

View original Excel after saving over it
In error, i hit save instead of save as. I'd like to view the original documents contents. is this at all possible. i use windows xp. excel 2003 Not very likely. Try a Google search action if you haven't already, but I think it's impossible. This underscores the importance of backups. -- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "houb" wrote: > In error, i hit save instead of save as. I'd like to view the original > documents contents. is this at all possible. i use windows xp. excel 2003 In article <C2A3F0E7-24E0-43A5-809A-ECA719...

printing imported gif files in Excel
When printing gif file with transparent background on the grey(25%) background of Excel non-transparent part of the picture has white border around it. Is there any way to prevent it? Thank you in advance... Tim ...

ExCel programming
I am working on a spreadsheet for work where it will calculate commissions to be earned based on my sales. There is a table that I have to use to determine what the percentage would be, how would I write an equation for that. For example, the equation would have to say: if say D3 was = or < than %, use cell# whatever and then have a sum in there. The table is on another sheet in the document so that would have to be there too. Basically, the way that my commissions are calculated is that we have to take what I sold in any given month and find out what percentage of my yearly plan i...

Some Excel formatting functions taking a long time to work #2
Excel 2000 SP3 When I use some formatting functions for the first time in a session, such as bold, increasing font size etc, it takes up to 30 seconds to work. Meantime Excel is locked up until it completes that formatting call. I suspect faulty DLL? Has anyone experienced this? How to fix (other than a complete re- install) ? Any advice appreciated. Piri On Nov 5, 8:39=A0am, Piri <wiremu.pare...@hotmail.com> wrote: > Excel 2000 SP3 > When I use some formatting functions for the first time in a > session, such as bold, increasing font size etc, it takes =A0up to 30 > secon...

question about Time
How to make the time result for example if it�s ( 1:01 ) or higher shows only as ( 1:00 ) and if it�s Lower like ( 0:59 ) or less it will show the same result in this case ( 0:59 ) Any idea & suggestions. Thanks, almufadda@hotmail.com ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ Using Ron deBruin's google addin and asking for subject round time, I get http://tinyurl.com/wgua -- Don Guillett SalesAid Software donaldb@281.com "saud" <saud.xgc4...

Time Clock Systems
Does anyone have a recommendation for a time clock system that integrates well with GP? On Oct 5, 10:20 am, kcd <k...@discussions.microsoft.com> wrote: > Does anyone have a recommendation for a time clock system that integrates > well with GP? We just implemented Time Matrix by Business Computers (www.business- computers.com) and are very happy with it. We implemented quickly the hardware wasn't propietary or complicated so we were able to source our own stuff. Troy I can speak highly of Unitime's time and attendance system. They are a relatively low cost solution t...

How to save Japanese characters in CSV format of Excel ?
Hi, I would like to know, how to save the Doubly-Byte characters.For example, Japanese in CSV of Excel.Here are the steps, I tried. 1. Open Excel 2. Copy pasted the Japanese charactesrs in a cell.It is displaying the characters correctly. 3. Save as CSV(Comma seperated file) It is saving as ??????. Thanks in advance for the info. ...

Short time vs short date
In my form I have a fldOutOfRoom which the user inputs a short time into the field, i.e, 0900. I have the following code in the open event of another form called frmRNnotes: If DateDiff("h", Forms!frmPtDemographicNew!frmVisitNewEdit.Form!OutOfRoom, Now) >= 1 Then Me.cmdRNnotesEdit.Visible = False This code gives the RN one hour to complete a note and then he/she can no longer edit the note. What I want to know is the Short Time format going to let the cmdRNnotesEdit button be visible everyday within one hour of the of the original time? That is, is the short time just a tim...

Macro
I need a macro that help me to transfer name and address information from an specific table in excel to a template in words on specific areas and then print the word document. The reason for this is that i need to create diferents letters to be sent to the customers from the excel table. Example of the table is: soc seg, customer name, child name, customer code, add 1 , add2, city, estate, zip code. all this information will be paste on word letter template on specific areas or fields. Any suggestion!!! -- nicoro Hi IMHO the best approach would be to set up a mail merge documen...

Adding a word to the end of other words at the same time
I was wondering if there was a way to add a word to the end or beginning of multiple other words in Excel. Example; say I have these 3 words.... Alpha Beta Tera Now I want to add LLC to the end of each word but I want to change them all at the same time. Like Alpha LLC Beta LLC Tera LLC Is there a way to do that? Phil Its Excel 2003 try Sub addtexttoend() For Each c In Selection c.Value = c & " xxx" Next End Sub -- Don Guillett SalesAid Software donaldb@281.com "phil" <ptukey@charter.net> wrote in message news:1125340358.873337.4240@g44g2000cwa.googlegroup...

Excel fun patch
Excel fun patch, have you see it? http://www.conus.info ...

Excel 2003
Sometimes when I receive excel attachments in my email (outlook 2003) they have a row height of 409.5 when I open them. I have to highlight the whole sheet and change the row height before I am able to view the data. This does not happen all the time and not from any particular person. I can forward the email to another machine with excel 2003 and they open it with no problem. I have downloaded all the patches and updates that I can find and still no help. This is just an annoying quirk that is driving me nuts. Does anyone have any ideas? TIA How about a couple of silly guesses that might t...

Need macro help to close excel
I have created a button in Access2000 that opens an Excel Spreadsheet. What I need now is assit in closing excel upon completion. I can get an excel macro to save my file and close the worksheet, but it is not closing excel entirely. I'm on project with this employer and could use a response today to fix this before I leave. Thanks much to any and all. My macro is as follows: Sub SaveClose() ' ' SaveClose Macro ' Macro recorded 9/27/2004 by cdjohnso ' ' Keyboard Shortcut: Ctrl+Shift+C ' ChDir "I:\SchoolsSurvey\Graphs_Reports" ActiveWorkb...

Excel Text Function (Right, Left)
My sheet has columns like this A 1. 63mmx 4kg 2. 75mmx 4kg SWR How can i detect that if a1:a2 is right,3 "swr", that it should be returned 3 otherwise 6. How can i add =right function with conditional formula. Help me Rao Ratan singh Hi =IF(RIGHT(A1,"SWR"),3,6) fill down your column (move cursor over bottom right hand corner of the cell when you see a +, double click) -- Cheers JulieD check out www.hcts.net.au/tipsandtricks.htm ....well i'm working on it anyway "Rao Ratan Singh" <RaoRatanSingh@discussions.microsoft.com> wrote in message news:D...

copy chart from Excel to Powerpoint
I am trying to copy a chart from Excel to Powerpoint, but the button is grayed out and it won't let me copy it. You can convert the chart to a GIF (a picture) with my Excel Objects converter. http://www.geocities.com/excelmarksway "Hoffperson" wrote: > I am trying to copy a chart from Excel to Powerpoint, but the button is > grayed out and it won't let me copy it. ...

Updating External Links Excel 2000 vs 2002/2003
I have a situation where I'm using Excel 2000 with a workbook containing references to another workbook. When opening the first workbook & the second workbook is not available, you can say "no" to the update external links, and still see all values as they were when the first workbook was last closed. However, when the same workbook is opened in Excel 2002 or 2003, the external links specified only as a cell reference show the proper data (e.g, =wbkname!E1), but when they are Excel formulae (specifically a SUMIF), I'm getting a #VALUE! error in the pertinent cells Is th...

How do I disable the handicapped feature in Excel?
Someone in my office turned the handicapped feature on and now you have to hold the key down for a couple of seconds or the letter never appears. Does anyone know how to reverse this? Duh! Nevermind. Not an Excel problem. Control Panel - Handicapped feature. Thanks. "TIrish" wrote: > Someone in my office turned the handicapped feature on and now you have to > hold the key down for a couple of seconds or the letter never appears. Does > anyone know how to reverse this? ...

display in taskbar in excel 2000
Hello, Have a problem! I work with Office 2000 and excel does not open more than onw screen in the taskbar. Windows in Taskbar, I checked in Excel. Clustered display is turned off in the properties of the Taskbar. Can anyone help me with this problem prog, get it only if I 2x open excel. Regards Rob Hi Rob, I can't figure out what exactly what is happening in your excel but try this, Go to TOOLS (Menu Bar) then OPTIONS, in VIEW tab just CHECK the Windows in Taskbar. Hope this will help. ~jaeson ...

Sending E-mails at a defined time with MS Exchange Server
We're using MS Exchange Server at the office. We have around 150 e-mail accounts set up. Some of our users are sending enourmous attachement (~100 Mega) and sometimes to 50 different addresses. During the day this is chewing up all our bandwith. What we would like to know if it's possible in Exchange to define that sort of rule : - Send e-mails with an attachment bigger than 8 M�g only after 20h00 ? (so they don't chew up the bandwith during the day as this has an impact on our FTP transmission module and our client server applications) Or maybe an add-on ? Any suggestions...

Excel 97 #13
How to spacing text in a cells dddd touch space bar kkkkk alt enter at the end of the line to break into two lines -- Don Guillett SalesAid Software donaldb@281.com "Tom" <anonymous@discussions.microsoft.com> wrote in message news:1689601c44803$0f6e5fd0$a401280a@phx.gbl... > How to spacing text in a cells ...