Solved

excel 2007 how to change cell format h:mm to h.mm

Posted on 2011-09-15
12
257 Views
Last Modified: 2012-06-21
Via Excel 2007 under 'Format cell format > Custom' I want to use the 'period' (fullstop) instead of the colon. This is because to input a colon into a cell one needs to press 'Shift' then colon, whereas a 'period' (fullstop) doesn't require 'Shift', and thus allows for quicker & easier input.

If I cannot change this format code, then I figure I would need to remap my keyboard keys.

Your thoughts would be appreciated please.
0
Comment
Question by:kazmdav
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
12 Comments
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36547302
Hello,

the cell format is for displaying the value, not for entering.

If you want to ENTER a time value with a different format, then you need to change your system settings for the time format. This will affect all applications on your system, though.

cheers, teylyn
0
 

Author Comment

by:kazmdav
ID: 36547315
Thank you Teylyn. I have now changed my system settings & will test things out later today.
0
 
LVL 2

Expert Comment

by:jan24
ID: 36549429
Good solution, teylyn.  If you want to only affect Excel, then you could instead leave your time settings as they are, and instead use a macro that catches the WorsheetChange event and converts decimal values to times.  If that sounds like a useful solution then let me know and I'd happily write that macro for you.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36552352
kazmday, jan24's suggestion would be good if you only need this behaviour in specific range of a spreadsheet.

I've recently written a VBA macro for a team who work under immense time pressure. They need to enter a date/time value and can't be slowed down by entering all the characters. So now they enter a number in 24 hr format and a + or - sign to indicate a day ahead or in the past, e.g.

15.00+ returns 3 pm tomorrow
7.00 returns 7 am today
0.30- returns 12:30 am yesterday

This only affects specific areas of the spreadsheet. In other cells, they can enter 15.30 as a number and it stays a number.

If that is something you are interested in, I'll dig it up.

cheers, teylyn
0
 

Author Comment

by:kazmdav
ID: 36552527
Thank you for both ideas. I had to confer with the end users, thus my delay.

Teylyn, your idea brought to light a requirement that they sometimes need to deal with, which is, calculating to / from number of hours (at a site visit) that spans across 1 day.

Therefore, I'd appreciate if you could dig up that macro please, because I think your macro will be a good start for me to work with.

I have a little VBA experience & will aim to modify it to calculate hours across a day and remove 'tomorrow' & 'today' text. If I need help I'll come back to the forum.

Regards, kazmdav
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36552663
Hello,

I'll dig up that macro, and modify it for publication, but in the meantime:

If you subtract one date/time value from another and the result is more than one day, then you can format the result with square brackets around the hour portion to show values greater than 24.

For example:

<Sept-13-2011 3pm> - <Sept-12-2011 8am>

The result is one day and 7 hours, or 31 hours. If that is formatted as a regular time value, you'd see only

7:00

If you format it with the custom format

[hh]:mm

it will be displayed as

31:00

The underlying value is the same, i.e. the number 1.291666667

cheers, teylyn
0
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 36552749
See the attached file for the macro I mention above.  

The values are actually entered as 900 or 2230, i.e. without a decimal point.

Hope you can do something with that.

cheers, teylyn
Simplified-Date-Time-entry.xlsm
0
 

Author Comment

by:kazmdav
ID: 36555177
Thank you Teylyn. I'll work on it & respond with how I go. Much appreciate your responses.
0
 

Author Comment

by:kazmdav
ID: 36577354
Hi Teylyn, I've been delayed due to catching a bug.... as soon as I recover I will get onto this. I will keep this question updated.
0
 

Author Comment

by:kazmdav
ID: 36937303
I'll be back on deck & will work on this on Tuesday 11 Oct.  It was quite a nasty bug and I thank you for your patience.

Regards, Kazmdav
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 36937630
Thanks for the heads up, Kazmdav. Glad to see you're back on deck.
0
 

Author Comment

by:kazmdav
ID: 36953678
Thank you. Your code worked like a charm Teylyn.

Apart from just changing the target range, I only needed to change the display format of the cells to just "h:mm AM/PM".  To do this I added one simple line of code in the 'Worksheet_Change' procedure; as indicated in attached code excerpt.

It might seem strange not to display the actual date in the cell, but its what the user wanted & he's happy!
' return target cell to general format
    Target.NumberFormat = "General"
    Target = TimeEntry(iTarget)
    Target.NumberFormat = "h:mm AM/PM"   < I added this line

Open in new window

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question