Solved

Excel Macro

Posted on 2013-06-18
4
276 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
  • 2
  • 2
4 Comments
 
LVL 6

Assisted Solution

by:Michael
Michael earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

My experience with Windows 10 over a one year period and suggestions for smooth operation
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
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…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now