Solved

Excel Macro

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
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.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 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