Solved

Excel Macro

Posted on 2013-06-18
4
311 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 250 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

Industry Leaders: 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!

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

717 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