Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel Macro

Posted on 2013-06-18
4
Medium Priority
?
321 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

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!

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

636 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