How to format a range of numbers (single column) to time format in MS Excel

Guys,
Can any one of you tell me how I can convert or format a range o
numbers in a single column into a range of times (time format)? Is i
possible?
Example..  0945 - 1000 is to be converted to 9:45 - 10:0

--
Message posted from http://www.ExcelForum.com

0
2/9/2004 7:27:55 PM
excel.misc 78881 articles. 5 followers. Follow

6 Replies
453 Views

Similar Articles

[PageSpeed] 30

Hi Sam,

Here's some code to do it

Dim cell As Range

    For Each cell In Selection
        cell.Value = TimeSerial(cell.Value \ 100, cell.Value Mod 100, 0)
    Next cell

-- 

HTH

Bob Phillips
    ... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sam96434 >" <<Sam96434.11dj4h@excelforum-nospam.com> wrote in message
news:Sam96434.11dj4h@excelforum-nospam.com...
> Guys,
> Can any one of you tell me how I can convert or format a range of
> numbers in a single column into a range of times (time format)? Is it
> possible?
> Example..  0945 - 1000 is to be converted to 9:45 - 10:00
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
bob.phillips1 (6510)
2/9/2004 7:44:35 PM
Sam
Here's a way to do it with a formula

=LEFT(A1,2)&":"&RIGHT(LEFT(A1,4),2)&" - "&LEFT(RIGHT(A1,4),2)&":"&RIGHT(A1,2

You can enter this formula in a seperate column, fill down, and then copy and paste_special over the original data

Good Luck
Mark Graesse
mark_graesser@yahoo.co
    
     ----- Sam96434 > wrote: ----
    
     Guys
     Can any one of you tell me how I can convert or format a range o
     numbers in a single column into a range of times (time format)? Is i
     possible
     Example..  0945 - 1000 is to be converted to 9:45 - 10:0
    
    
     --
     Message posted from http://www.ExcelForum.com
    
     
0
anonymous (74717)
2/9/2004 9:01:06 PM
One more that just looks like a range of time:

=TEXT(--LEFT(A1,4),"00\:00")&" - "&TEXT(--RIGHT(A1,4),"00\:00")

But I think I'd put each time in a separate cell:

=--TEXT(--(LEFT(A1,4)&"00"),"00\:00\:00")
and
=--TEXT(--RIGHT(A1,4)&"00","00\:00\:00")

And format each as hh:mm

When the values are really time, you'll be able to do other things (date/time
arithmetic) with them.

"Sam96434 <" wrote:
> 
> Guys,
> Can any one of you tell me how I can convert or format a range of
> numbers in a single column into a range of times (time format)? Is it
> possible?
> Example..  0945 - 1000 is to be converted to 9:45 - 10:00
> 
> ---
> Message posted from http://www.ExcelForum.com/

-- 

Dave Peterson
ec35720@msn.com
0
ec35720 (10082)
2/10/2004 1:23:46 AM
Thanks Mark for the formula. But I would like to know how you can
generalize for all the rows. Because each time, you have to change the
row number. 
for example

LEFT(A1,2)&":"&RIGHT(LEFT(A1,4),2)&
in this expression..A1 is the value of column A - row 1. So I would
have to keep on changing the row numbers to apply it to all rows. I
hope you understand my question.
Thanks so much.
Sam.


---
Message posted from http://www.ExcelForum.com/

0
2/12/2004 8:24:02 PM
Thanks Mark for the formula. But I would like to know how you ca
generalize for all the rows. Because each time, you have to change th
row number. 
for example

LEFT(A1,2)&":"&RIGHT(LEFT(A1,4),2)&
in this expression..A1 is the value of column A - row 1. So I woul
have to keep on changing the row numbers to apply it to all rows. 
hope you understand my question.
Thanks so much.
Sam

--
Message posted from http://www.ExcelForum.com

0
2/12/2004 8:30:20 PM
Thanks Mark and Philip for the answers..I really appreciate you
knowledge.
Sam

--
Message posted from http://www.ExcelForum.com

0
2/12/2004 8:42:56 PM
Reply:

Similar Artilces:

Freezing rows & columns
I have formatted my sheet perfectly, but when I freeze the appropriat section excel inserts a big line (to show whats frozen) thus disruptin my formatting. Is anyone aware of a means of freezing WITHOUT the line? CHEER ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements You can't hide the "freeze" line. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson So...

excel file size 0
Yesterday I saw alll excel, word files size 0 Kb from Windows Explorer. Please could you tell me what kind of virus attack my file and the name of virus I would be glad if you reply as soon as possible Thank Dokles Better to run your AV to get this information. You dont have an up to date AV? Hmmm. Go to www.housecall.trendmicro.com and run their online Scanner. Go to www.grisoft.com and DL their FREE AV "Dokles" <dokles@lycos.com> wrote in message news:3C539357-BDE2-4908-BCC1-ED456AB645F6@microsoft.com... : Yesterday I saw alll excel, word files size 0 Kb from Windows ...

negative number format
I have a report uploaded to excel from a particular program used here at work. In that program, negative numbers have the format of $###.00-, with the minus sign at the end instead of the beginning. When the data comes over to Excel the minus sign is still at the end of the number. The text currently has a General Format with No Specific Number Format. I have been manually moving the minus signs to the beginning in each cell, then changing the Column to Currency Number Format which is very time consuming. Is there a formula I can use in the Cell, Column and/or Worksheet containing...

Change date format to European format
My computer is set to European date format but Excel is default to American date format. Can someone advise how to change this default setting. Thanks, Scott Have you restarted Excel since setting the system date formatting? Excel takes its cue from the OS on launch. Also, double-check the Regional setting in the System Prefs. If those aren't the cause you'll need to be specific about your version & update levels of both Office & OS X plus any other details you can supply. -- HTH |:>) Bob Jones [MVP] Office:Mac "Scott" <NoSpam-Scot...

Formatting just some rows
Thank you so much for that, it'll save loadsa time. I adjusted the formula as the original sheet contined 11 columns of data. Can you help with this part now? The original sheet had dates in Column E (in the form Jan-03). Thay have come through on the new sheet in the single column as 5 digit figures such as 37622. Is there any way of getting the original form of the date back, affecting just rows 5, 16, 27 etc...of the new sheet? Perhaps I need to format just these rows on the NEW sheet. A similar problem exists with column I of the original where the � sign has been lost. Again is t...

How do I do dashboard charts in Excel
I have 3 sets (budget, forecast and actual) of sales and profit numbers and would like to show them like a dashboard ( two small circles for Budget and Forecast and a bigger one underneath those two for Actual. All 3 circles with a hand point to the numbers linked to the source data ). Can anyone tell me how to make a start? Thanks and regards Nick Hi Nick, Here are some examples of speedo type gauges. http://peltiertech.com/Excel/Charts/Speedometer.html http://www.andypope.info/charts/gauge.htm Cheers Andy Nick Cheng wrote: > I have 3 sets (budget, forecast and actual) of sales a...

freezing formatting
I would like to be able to "freeze" the formatting for the number of decimal places in cells - some will need to be integers, some will need three decimal places, etc. The problem comes when I paste in information; the number of decimal places I have formatted the cell for is overridden by the pasted-in data. Any ideas? On Fri, 24 Oct 2003 13:31:05 -0700, "H" <anonymous@discussions.microsoft.com> wrote: >I would like to be able to "freeze" the formatting for the number of decimal places in cells - some will need to be integers, some will need three de...

Question about format of reply and format of message
I have two questions about OL2003: 1. Word is set as default editor. In replying message, sometimes I will get extra lines on hitting Enter. It makes more space between paragraphs. Is there any way to insert one line with one Enter? 2. I'd like to have special effect in replying text message sometimes, such as change color of font, but it cannot be done unless changing the message format to be rich text or HTML. If I uncheck Word as default editor, there is an option in menu. What is it about with Word as editor? Thanks, Charles 1 - Check the paragraph spacing settings e...

Outlook express columns
Hi In outlook express I've created a sub folder in the Sent Items folders but it shows the column format used by the Inbox folder. If I change the columns it changes the columns for all folders exept Sent Items. How do I set different folders to show different columns ? Thanks Ask in an Outlook Express forum. This is an Microsoft Office Outlook forum. Outlook Express is family of Internet Explorer and Outlook of the Office family. Here is the link for the right forum http://communities.microsoft.com/newsgroups/default.asp?icp=InternetExplorer Good Luck! -- Robert Sparnaaij [MVP-Out...

how to compare column?
How do I compare colume column A column B column C 22 33 B 22 14 12 3 27 45 B 55 40 How to compare column A with column B, then if B is greater than A, indicate B in column C? Thank you. Put this in C1: =3DIF(B1>A1,"B","") and copy down as required. Hope this helps. Pete On Jan 18, 12:33=A0am, "Able Cox" <no.s...@no.spam.com> wrote: > How do I compare colume > > column A =A0 =A0column B =A0 =A0column C > 22 =A0 =A0 =A0 =A0 =A0 =A033 =A0 =A0 =A0 =A0 =...

Excel Upgrade question
We are using MS Office 2000 Professional. We would like to upgrade only the Excel 2000 to 2003. Can we just upgrade Excel without upgrading the whole MS Office suite? If so, should we expect any conflicts when we run MS Word 2000, PowerPoint 2000, etc or can Excel run nicely on it's own? Our systems are 2 year old XP Pro and Home versions. Thanks for any informative response. -- ADArnold ------------------------------------------------------------------------ ADArnold's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=12106 View this thread: http://www.excelf...

Negative number formatting
Hi everyone, does anyone know how to do this? I hve a column of figures some positive and some negative. I want to format them so taht th negative numbers are expressed in (brackets) and also so that th column itself is decimal aligned, so even if I don't use decimal place the brackets "stick out". I know Word does this in tables, but I can' seem to make Excel do it. Help! Thanks, Vicky. :confused -- VickyJone ----------------------------------------------------------------------- VickyJones's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2448 ...

Format Smartlist field
Is it possible to format a smartlist field? Let's say from 2 decimals to 4 decimals? -- SmokyDuck This is only possible in SmartList Builder SmartLists, not in the 'out of the box' SmartLists. In SmartList Builder, you can click on the Display Name of a field, then click the blue arrow in the header to go to Set Field Options. For number fields there will be a tab called Decimal Places. -- Victoria Yudin Dynamics GP MVP Flexible Solutions, Inc. "Smokyduck" <Smokyduck@discussions.microsoft.com> wrote in message news:98223149-4092-484D-886D-F03A319319E...

Enforce format
How can I "enforce" a format in a cell in excel so that it allows number entry only, i.e. it does not allow letters or any other characters. Thanks in advance. Keith Data Validation; custom formula; If active cell is A1, use this: =NOT(ISERROR(1*A1)) "Elfey1001" <Elfey1001@discussions.microsoft.com> wrote in message news:D744EEFC-3BD0-43A7-B673-F16107BBFA03@microsoft.com... > How can I "enforce" a format in a cell in excel so that it allows number > entry only, i.e. it does not allow letters or any other characters. > Thanks in advance. > Kei...

Windows mail won't send ms excel attchments
windows mail won't send either MS Excel 97-2003 or 2007 formats if I try to send either by itself. I have to attach same file I want to send in both formats. Then, only the 97-2003 format actually gets through. Either way, I'm getting notice that Mail can't send one or more attachments. Any suggestions to help eliminate the glitch would be most appreciated. Windows Mail doesn't care what the attachment is. But make sure the file you are trying to attach is not open anywhere else (i.e. in Excel). Gary VanderMolen, Microsoft MVP (Mail) "woodrow" wrot...

Conditional Formating Help
Hi I wonder if anyone could help me, I am after code for the following. cell e6 = Keys Sent Column f6 = Keys due Column g6 = Keys received What I want the script to do is if there is no value in g6 and todays date is greater then the date stated in F6, then the cell turns red (prompt to inform me that keys are late). Many thanks Dan Use a CF formula of =AND(G6="",TODAY()>F6) HTH Bob "housinglad" <housinglad@discussions.microsoft.com> wrote in message news:A5887369-33DA-489A-BEC9-8173707313C6@microsoft.com... > Hi > ...

Outlook 2003 unresponsive when viewing messages in HTML format.
About two weeks ago, I started Outlook and went in to view messages. On some messages, Outlook would appear to lock up and my harddrive light would come on continuously for a minute or more. The body of the message would appear as an empty window. We have discovered that the problem only occurs for email messages that are in HTML format. I can prevent the problem by going to: Tools > Options > Email Options and checking "Read all standard mail in plain text". When I have this option turned on, I can see a plain text version of the message. Unfortunately, much of ...

Select Case Conditional Formatting Sub?
I've tried to use the Sub below (Posted by Julie D I think) as a work around for more than three conditional formats and it works great IF I enter the data directly in the target cells. But, if the taget range is populated by a formula the color changes do not occur. Is there a way to modify this to work when the cells in the target range are formula driven? (Or, maybe I'm doing something wrong, any ideas?) Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("B6:B10")) Is Nothing...

Add opt. to change Printer-Friendly format to user defined format
This is a customer suggestion from Convergence. Customer would like to be able to have the option to change the Printer-Friendly format to a different/user defined format. 1. Employee enters a requisition. 2. Purchasing manager processes the Requisition: BP>Purchasing>Requisitions 3. Select a vendor and requisition. 3. User selects to view the requisition; Printer-Friendly Version opens. ISSUE: Currently, there are no options to define report format. For further inquiry- Customer Information: Jon Heseman, PC Administrator EFCO Systems 1800 N.E. Broadway Des Moines, Iowa...

Searching through DB Table containing Records in XML format
Guru's! Your time and guidance is much appreciated in this task that i am trying to get done. Background I have a SQL Server 2000 database table which contains 2 Fields (RecordID, XMLData (datatype=TEXT). There are about 10,000 records in this table. The Data in the field (XMLData) is a XML formatted string. (where F1,F2... are elements and v1, v2 is the data) <ControlRecord><F1>V1</F1><F2>V2</F2><F3>V3</F3><F4>V4</F4><F5>v5</F5><f6>v6 </f6>.....Upto 14 fields </ControlRecord> <ControlRecord><...

How to format the value in a cell?
Hello! I wonder if excel has the function to format a value in cell without the help of Macro. To format a value,here I mean to correct the value automatically. For example,it need the value in a cell to be "T".But a user may enter " T","T ","t".The formatting function used here to trim the space at the begining or end of "T",or change the "t" to upper case. -------------------- An Try =TRIM(UPPER(A1)) -- Regards Roger Govier "An" <abc@sohu.com> wrote in message news:u%23Kg%23X6hFHA.576@tk2msftngp13.phx.gb...

Pasting Excel charts into Word
Whenever I paste Excel charts into Word, the fonts end up looking terrible. Is there an easy solution? Pasting as a picture does not work. The only thing that does work is right clicking on the chart while in Word, selecting "Edit Picture", then fixing the text that has changed position and direction. But then my chart is no longer a simple picture. Help! How are you pasting it? I have no problem using the Word Insert Object command. 1 - In Excel, have the chart saved in its own separate .xls file, no other worksheets. 2 - In Word, choose Insert>Object. 3 - Click on the Cre...

extracting data from one format to a different format...
I have a large database of company contacts that is formatted/entered as follows: ABC Company, Inc. John Doe 123 Main Street NE Des Moines, IA 52000 Phone: 123-456-7890 Fax: 098-765-4321 jdoe@abccompany.com Each line is in it's own cell, but I need it in column format such as follows: Company Name - First Name - Last Name - Address1 - Address2 - City - State - Zip - Phone - Fax - Email Any direction as to how I can easily do this? I'm using either 2003 or 2007 and have over 7,000 entries like this. PLEASE HELP as I don't want to spend hours into days try...

Excel Problem with Width=1.00
Draw a shape, for example rectangle and make its width=1cm. Then open its properties again and look its width. It's 1.01 cm now Is there any way to make the widths of shapes or images EXACTLY 1 cm. ...

Remove formatting from SSN
I exported some data from an Access database. The Social Security Numbers are in this format: 123-45-6789. I would like to change them all to 123456789. I've tried creating a Custom Format and formatting the cells, but nothing changed. Tried setting the format of a new column, then cutting and pasting or Paste Special into the new cells, but it keeps the old formatting. Is there an answer? Try this in a "helper" column: =TEXT(A1,"000000000") To retain your leading zeroes. -- HTH, RD ============================================== Please keep all corres...