?
Solved

Excel Macro

Posted on 2013-06-18
4
Medium Priority
?
314 Views
Last Modified: 2013-06-24
I have a spreadsheet that I am working on that displays the following information
A               B                                                              G
Time In       Time Out
8:00 AM      5:00 PM
8:00 AM      3:29 PM


I want it to display the hours between the 2 in column G. 9 hours for the first row and 7 hours 29 minutes for the second. Is that possible, what is the best way to do it?

I am using Excel 2010.
0
Comment
Question by:Bryant
[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
  • 2
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:Michael
Michael earned 1000 total points
ID: 39257815
In G2 type the formula =B2-A2
then copy the formula down
Select column G and press ctrl+1 to goto the cell formatting
Goto 'custom' and type u:mm
This should show the time difference in hours and minutes
0
 

Accepted Solution

by:
Bryant earned 0 total points
ID: 39260620
Hi JazzyJoop,

You are partially correct but I was able to get my solution based of what you said..

In addition to what you said I right clicked column G and click format cell. I selected 'time' and selected 13:30. When I tried to use what you proposed I got an error. I change your u:mm to h:mm and got a result but it listed it in AM or PM and I just wanted the hours and minutes. So the solution is as follows.

In G2 type =B2-A2
Copy the formula down to however many cells you need
Select column G; right click>Format Cells>
Select 'Time' to your left
Select 13:30 which is usually the second option.
Select OK

You should see the difference in hours and minutes from times input into column A and column B.
0
 
LVL 6

Expert Comment

by:Michael
ID: 39260664
Yes you're right.
Indeed u:mm should be h:mm. That was a language issue/setting.
Selecting 13:30 gives me the same as h:mm.

I'm glad you figured it out and I could give you a starting point.
0
 

Author Closing Comment

by:Bryant
ID: 39270701
I selected my own comment as teh solution because the other solution was only partially correct. It did jump start what I found to be the complete solution of what I was looking for.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

770 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