Tracker
HOME    TRACKER    Excel

# If Statement For Hour And Min

## how to change the below statement to allow for when the time in B9 is 1:01 so it displays as 1 Hr 1 Min. I tried an IF statement to change the hr but i cant seem to find a way to change the Mins at the same time. HOUR(b9)&" Hrs "&MINUTE(b9)&" Mins

Related Forum Messages:
Changing Date/time To Run A 12 Hour Production Schedule, And Not 24 Hour
I have created a daily schedule which has a number of factory variables taken into consideration which determine the date and time a particular product should, barring any mechanical problems, come off the machine. (see attached spreadsheet).

The date at the top will be editable by me only so that when I update the production quantities, the “date/time off” column automatically re-adjusts to the remaining quantities.

The formulas are a little long winded, but I have left them that way whilst I try and develop it. I should be able to figure out how to condense them later.

My problem is that the “date/time off” on the right works excellent, but over a 24 hr period.

Ordinarily, we work a 12 hour day (6am to 6pm) with overlapping shifts to cover breaks, and 20 mins warm up at the start of the day for the machine, thus maximising a 12 hour day.

Of course if demand exceeds the allotted time we put on overtime.

Is it possible to specify that normal days are only 12 hours so that if a product exceeds 6pm, it flows into the next day with the balance starting at 6:20am?

And, if the production for the week exceeds the time could I stipulate particular days which we deem are suitable for overtime? Ie, we decide Wednesday is a 14 hour day and not 12.

I had toyed with the idea of creating a 365 day table/calendar, on another worksheet which would have its individual allocated hours in an adjacent column and somehow link them to the date/time off, perhaps by way of a VLOOKUP, but I have been chasing my tail trying to figure out how to implement it.

CONVERT 24-Hour Time To 12-Hour Time
I have a list of FLIGHT departure times that are listed in MIL TIME, however, there is no : in the format. Its just 4 or 3 digit numbers. I need to convert these to time in 12-hour clock. If I go to FORMAT/CELL/TIME and select 1:30pm it simply makes the time ZERO!

Convert To 12-hour Time From 24-hour Time
I'd like to convert from 24 hour standard time to 12 hour time using VBA code. For example: instead of 13:00 I need 1:00.

Hour (now)
I have this

Select Case Hour(Format(now, "13:00"))
Case Is >= 7, Is = 15, Is = 23, Is

Utilize A Select Case Statement In Target Intersect Statement
I am currently using an Intersect statement in a worksheet module to perform two things:
1. Insert a time stamp into row 2 when row 1 has a price inserted
2.To clear that time stamp if the price is deleted at some later date.

My problem is with the time stamp value being deleted by the user.
If I try to clear the price (now that the time cell =empty) I get a Runtime error 91 - Object Variable or With block variable not set.

I would like to convert this code to a select case statement but I'm not sure how to do this in this situation. Would error coding be appropriate in this instance?

How To Get A Macro To Run Exactly On The Hour And Day
I do not understand how to get a macro to run exactly on the hour, each hour of a day, day after day?

Change To Hour
How do I change a column of times from "h:mmAM" to just "h"?

24 Hour Timesheet
I am having trouble with this formula

=IF(E4-D4 < 1/24*7.1,E4-D4,E4-D4-1/24)*24

it works well unless the staff member works past midnight. I get a negative hours worked value returned.

for eg

E4=8AM and D4 is 5PM i get an answer of 9 hours in F4, this is all good but if the start time E4=4PM and the finish is D4=1AM then I get the result of -15 hours in F4

Run Macro Every Hour
I have a macro I need to run every hour. I have tried 3 different macros that seem to work the first few times but then the code executes and will run 2 or more times.

Application.OnTime ("01:00:01"), "macro1"

Application.OnTime Date+TimeValue("07:05:00"), "macro1"

I then tried this http://www.cpearson.com/excel/OnTime.aspx

Chart Over A 24 Hour Period
I'm attempting to chart 3 series over a 24 hour period (8am-8am). The 3 series are captured in 1 minute intervals. My X axis intervals is displayed hourly though. My issue is, charting goes bad at 00:00:00. i.e. it stops.

Here are the values I have on my X axis

min: .33333
max: 1.35
maj: .04167
min: .00347
cross at: .33333

Any ideas how I can get from 8am to 8am?

1/2 Hour Intervals To 15 Minutes
08:00 26calls
12:00 50calls
16:30 16calls

The problem is the data is output as above just outputing intervals with data.

I need to convert this data to 15 minute intervals as below:

08:00 13calls
08:15 13calls
12:00 25calls
12:30 25calls
16:30 8calls
16:45 8calls

24 Hour Double Time
I have a timesheet which for certain days of the year calculates double-time. What i would like to do is have a formula that gives double time for a 24 hour period. I have a formula setup with a start time and end time for my double time, but it wont stop at midnight.

Counting Entries Per Hour
My spreadsheet contains two text columns that represent dates and times; 11/21/2007 and 0935 for example. The rows are populated with the date and time for every event during a 48 hour period. A single worksheet may contain up to 3,000 events (rows).

How do I create a subtotal for the number of events in each of the forty-eight 1-hour periods?

Calculating Episodes Per Hour
I need to calculate the number of calls my operators take per hour of the day in order to calculate the busiest times of the day. Each call is time stamped and captured but now how do I calculate the total number of calls taken between 07:00:00 and 07:59:59 etc etc for the whole 24 hour period?

Converting Digit To Hour
I have simple (or not) question:
how can I convert a digit that I input into a cell to an hour format ?

I want to achieve something like this:
- when I input a digit into a cell , for example: 9 a want to convert it to 9:00 (9 hours, 0 minutes). How can I do it ?

I have a start time in cell A1 (say 9am entered as 900), cell B1 has a time interval (25min), Cell C1 gives total (925). Cell B2 has the next time interval (56min). How do I get cell C2 to give total of 1021 rather than 981? Values in columns B and C continue on down.

Automatically Show Every Hour
What other code than that shown below do i need to make my message box work,

"Module Code"
Sub MyMacro()

Application .OnTime TimeValue("00:00:00"), "MyMacro", ["23:00:00],
[TimeValue "01:00:00"=True]
MsgBox(BoMLogDue, vbOKOnly, BoMLogDue) As VbMsgBoxStyle

End Sub

"Workbook Code"
Private Sub Workbook_Open()
Application.OnTime TimeValue("00:00:00"), "MyMacro", ["23:00:00],
[TimeValue "01:00:00"=True]
End Sub

Extract Hour From Time In Cell Using VBA
If I had a cell containing a time, 06:30 in A1 for example, how would I use VBA in the following argument:

If the hour in A1

Working With Time: Blocks Every Whole Hour
I have a spreadsheet that users input the temperature each hour, for a 24 hour period. The time used is 24hr clock, as example, cell A1 will be 03:00, and cell B1 would be the forecasted temperature.

On another sheet, the user inputs the temperature for the specific time a airplane is going to take off, i:e: 07:32. Is there a way I can have the second sheet look back to the first sheet and grab the temperature for the correct time (using the hour block it falls into). The first sheet time blocks are every whole hour, i.e 08:00, but on the second sheet, the time could be any hour/minute, 07:32.

Count Time (entries Per Hour)
I have a bunch of data and I want to be able to count the number of entries that fall within each of the 24 hour increments in a 24 hour clock. (military time)

For 12:00:00 all times would be between and including 12:00:00 and 12:59:59

Column B | Count
------------------
12:00:00 344
13:00:00 44
14:00:00 5

Rounding Timesheet To Quarter Hour
I have made a time sheet and am trying to have the total hours and grand total- round up to the nearest quarter hour, I.E. (.25, .50, .75. 00), if anyone can help me please it will greatly be appreciated, this is what i have now, in my totals fields:

ROUND(IF((OR(B13="",C13="")),0,IF((C13<B13),((C13-B13)*24)+24,(C13-B13)*G1424))+IF((OR(E13="",F13="")),0,IF((F13<E13),((F13-E13)*24)+24,(F13-E13)*24)),2)

I Have also attached the file so you can see it completely.

Weighted Average To Come Up With A Speed Value For Each Hour
I have a spreadsheet with the following data that elapses an entire year, broken down into 24 hourly sections per day:

column A: hour of the day (from 0 to 23)
column B: vehicle group (separated into "Passenger", "SingleUnit", and "TractorTrailer")
column C: average speed for that vehicle group for the corresponding hour
column D: total volume/number of vehicles in that vehicle group for the corresponding hour

I would like to apply a weighted average to come up with a speed value for each hour (i.e. combine the average speeds for each of the 3 vehicle groups based on their relative volumes across the entire dataset).

My final table should show only:
Hour (from 0-23), Avg. Speed (containing the weighted averages from the dataset)

Attached is a screenshot example.

Calculating Time Across A 24 Hour Period
Calculate certain time increments for various work-shifts. I have a start time,finish time and increments of time across the spectrum of 24 hours. There are also multiple start time across the 24 hour period with some start times begining on one day and ending on the next day.

Example

In B5 Startime is 22:00
In C5 Finishtime is 06:30

In I3 increment begins at 00:00
In I4 increment ends at 00:30

The employee working the shift from 22:00 - 06:30 would fall into the time increment of 00:00 - 00:30 where another employee working a different shift (08:30 - 17:00) would not. I'm looking for a formula that would return a 1 in a cell if the employee fell into the 00:00 - 00:30 time increment and a 0 in a cell in the employee did not fall into the time increment.

Rounding To The Neartest Quarter Hour
I have searched around and have found several formulas designed to round to the nearest 15 min interval, but none seem to be working for me. If anyone has some insight.
A1 A2
R1 Main Task Total in Hours
R2 Sub Tasking 1 30 min
R3 Sub Tasking 2 6 min
R4 Sub Tasking 3 5 min
R5 Sub Tasking 4 23 min

What I need to happen is for the total of the time allotted for each tasking to be added and rounded to the nearest 15 min interval in a hour.min format. For instance, the above would be rounded to 1.25

71 mins total, rounded to 1.25 because .25 is one quarter of an hour in decimal form. I need it to be this way to be able to multiply that by a charge amount for a total cost for the Main Task. The numbers in A2 will all be whole integers.

Convert Hh:mm.* To 12 Hour Time Format
I have a ton of time in the above format (hh:mm.*) that needs to be converted to a 12 hour format (2:15 PM). I'm not wonderful with formulas, but if it's explained "simplistic" enough, I can probably get it. Please help - I've googled this to death every possible way. I can go in an manually change 19:37.5 to 7:37 pm - but it will take me FOREVER!

Job Hour Tracking With Pivot Tables
I have an Excel timesheet that the supervisor loads the time (in and out) for all the shop employees. These employees may work up to six different jobs in one day at various points throughout the day. I have no problem with calcs and formats on the daily time entry tab (sheet1). What I need is a way to track each job using a running total so that as the job is in progress we can see how we are doing against estimated hours. I thought perhaps I should at least make a weekly time summary pivot table thinking that it would make it easier to calculate, but it didn't help with running totals. The summary included (5) copies of the same daily entry tab (sheet1) just given a different name, in this case ..a simple date change and save the sheet with the date used. OK, here's the problem. How do I create a running total that would track each job? I forgot to mention earlier that each daily time entry sheet is saved and named by the date for which it represents. The weekly time summary pivot table works fine....but it only gives me the grand total of hours worked for each day...not a running total summary. I can view the pivot tables and go to the calcualtor and add the hours up per job, but that's defeating the purpose. Anyway, I hope this is clear enough to at least get some responses. Then, maybe by then I'll have a better understanding how to ask the right questions.

How Do I Round To Nearest Quarter Hour
I need to round a time to the nearest quarter hour and have it show in quarters. My formula figures out the hours worked. If the total is 8.36, then it needs to show 8.75. It needs to round up or down to nearest quater hour.

How Do I Set Up A Formula For Parts (or Units) Per Hour
I'm trying to set up a spreadsheet that tracks total hours worked and total
units produced. Then I need to have a column that shows how many units per
hour were produced.

Currently, I have something like this:
Column A is in elapsed time [h]:mm
Column B is a Number with two decimal places
Column C divides Column B by Column A

However, I get strange results. For example:
Column A is 6:24:00
Column B is 13
Column C shows 120.00

13 parts in 6:24 hours should be something like 2.1666 parts per hour!

Add Hour/minute To Time On Other Cell
I am creating a Little League Schedule and want to start Saturday games and have the lower cells ad 2hr 45min to whatever time I post in the upper cell

Automatically Refresh A Sheet Every Hour
I have a workseet that is basically a massive list of orders that have been placed. I have some conditional formatting based on cells that use the today() function to work out how long (in days) since the order was placed.

Trouble is, the spreadsheet is always open, and is never closed down... so it does not refresh automatically. So orders that should go red to indicate a week since they've been placed, don't!

I don't want to rely on people refreshing the screen. Ideally, I would like it to refresh once a day at 1 minute past midnight, or even every hour...

Multiply Number Per Hour Or X Minutes
I am wanting to take a number (any number) and multiply it by per minute using real time. For example: Say I have 12 apples. I want that 12 apples to multiply per hour.

12x(per 60 minutes)= total
The total will change every hour because the formula will be using real time. I can write the formula for 12x60 but to enter the time, based on real time I just don't know or even if it can be done.

12-hour Time Entry Stored As Text
I have a problem with entering 12-hour time data in excel.

If I key in 3:00, Excel will recognise it as 3:00 AM.
If I key in 3:00 p, Excel will recognise it as a text entry. To get Excel to recognise it as 3:00 PM, I have to use the 24-hour format. i.e. I have to type 15:00.

I have checked the Regional and Language option in the Control Panel. Everything looks fine.

Does anyone have such encounter with Excel before?

How To Type In 2 Decimal Places In 1/4 Hour Display
I have to change a time sheet that was previously in HH:mm to display in decimals, but to the nearest 1/4 hour ( 0.25 (=15 mins), 0.50 (= 30 mins), 0.75 (=45 mins), and 1.00 (1 hour))

This is not a formula question, but a format/display question as the cells have to be typed in by different people who up until now have beeb used to typing in the HH:mm format.

This means;
8:15hrs would become 8.25
8:30hrs would become 8.5
8:45hrs would become 8.75

The reason behind the change is a head office wallah that needs to have time in decimals and not true minutes.

Is there a way to;
prevent user from entering any decimal other than .00; .25;.50;.75
or change formatting to turn red if any other than above is entered.

Alternatively, is there a way of me (the collator for 50 people) being able to take data from their sheets (which I have to do monthly) which could be a formula...

I have tried to get head office to change, but they say that they collate data for 13 other sites and all the others are OK (thats cos all the others receive their data on PAPER and one person tabluates them)...

Delete Lines If Words Are Repeated And Hour Is The Same
I have tabulated data from columns A to I, in column B words different only in last letter, going from A to C,

column F=Date and column G=Hour, something like this: ...

Automatic Colons For Hour:minute Entries
how to format a cell, or what formula to use, so that when an entry is made the colon is automatically put in? so that 1011 shows as 10:11

Using COUNTIF To Determine # Of Employees Working Each Hour
I'm using Excel to schedule employees shifts at my restaurant. Column A is their name, Column B is their start time, Column C is their end time. I'd like to be able to count the number of employees working during any given hour of the day to assure I've got enough staffing each hour. I'm thinking it will require a COUNTIF function but I can't figure out how to make it work. I've attached a sample sheet.

Total Hour Difference Between 2 Dates & Times
I have two rows of data (A & D) which I would like to determine the amout of time spent for each issue. The value in both column appears as DD/MMM/YY HH:MM:SS. I am looking for a formula to obtain the below result.

Desired Output:
A1 = 05/21/08 10:00:00
D1 = 05/22/08 13:01:00
E1 = 27:01 hours

Day Hour Minute Format To Total Hours
We have a system called Datamart that outputs in excel formatted file.

The output of a duration is : 22.00:8.00:25.00 ( day hour minutes )

I want to be able to add, subtract, average, calculate the 10 fastest/slowests durations from a list of durations in this same format. I have googled and tried custom formatting but excel does not like this format. when I try to sum a range and divide by the number excel gives me 0.

Autofill Date/Time: Increment By 1 Hour
I have a column with dates + time under this format: 2005-01-01 00:00:00. I wanted the same thing for the whole year, so, I wrote 2005-01-01 01:00:00. in the cell below, and then did an autofill.

Unfortunately, at some point, the cell goes from
2005-01-05 03:00:00
to
2005-01-05 03:59:59
which is a problem for me, because I was using the hour as an indicator.
And hour(2005-01-05 03:59:59) returns 3 and not 4!

Convert Day:Hour:Minute To Valid Times
We have a report application and developers that are giving us a real challenge.

1) if you have a cell formatted with:

DD:HH:MM and have a 4 digit numeric value for each section:
47.00:0.00:59.00
you can use the following formula to convert to hours minutes that excel can handle:
=(LEFT(P18,4))+MID(P18, FIND(":",P18)+1,4)/24+MID(P18, FIND(":",P18,7)+1,4)/1440

2) if you have a cell formatted with:
DD:HH:MM and have a 2 digit numeric value for each section:
47:00:59
you can use the following formula to convert to hours minutes that excel can handle:
=(LEFT(P4,2))+MID(P4, FIND(":",P4)+1,2)/24+MID(P4, FIND(":",P4,5)+1,2)/1440

Problem:
our developers have created a new report that now has a variable format
D:H:M
2:6:33
4:3:3
0:22:5
0:2:2
22:0:1..................

Formula That Allows Me To Type In Their Hour Work If It's Greater Than 40 Hours
I am building a spreadsheet to manage 15 folks wages to be able to know how much money has been spent.
We routinely work 40 hour weeks and have a sheet that automatically multiplies hour work by person (Say A1) times their hourly rate (say A2)

My question is how could I right it a formula that allows me to type in their hour work (A1) if it's greater than 40 hours?

Say A1 is 40, A2 =\$20.00, A3 =(A1*A2) \$800.00

If the A1 is 43 what would I put into A3 that would automatically multiply the additional hours over 40 times 1.5 A2

Calculate Business Hour Downtime Excluding Weekends
I am trying to calculate downtime for a Service Level Agreement.

The data that I have is the start date/time and the resolved date/time for an incident.

The data are in the format - 1/1/2008 03:32 AM. The incidents may occur at any time but downtime is calculated only business hours and excludes weekends. I may be required to exclude holidays but that is not a hard requirement right now. What I must be able to specify are the working hours.

As example(s)
- if an incident is generated on 1/2/2008 4:00 PM and resolved at 1/3/2008 11:00 AM then the downtime is 4 hours.
- if an incident is generated on 1/12/2008 4:00 PM (which is a Sat) and resolved at 1/14/2008 11:00 AM (which is Monday) then the downtime is 3 hours.

The above assumes working hours are 8:00 AM through 5:00 PM.

I have tried using the NETWORKDAYS and WORKDAY functions with little success.

Count The Number Of Entries On A Sheet That Match An Hour
I'm trying to Count the number of Entries on a Sheet that match an Hour. Looking through the availiable functions i found COUNTIFS, which is exactly what I want. However, when I try to compare the Hour values within the COUNTIFS arguments, there is an error.

This is the function that I figured would work here:
=COUNTIFS(HOUR(Sheet1!G:G), HOUR(E6))

which should count all entries in column G where its HOUR matches the HOUR in E6 (all are time format). I do realize that in the example above there is only one comparison made and i'm using COUNTIFS instead of COUNTIF, but i'll be adding other comparisons to it once i get this first comparison working.

Round Total Time To One Hour Multiples With A Minimum Of Two
I need a basic formula that will take my start time from my end time and round it up to the next hour with a two hour minimum. I formated my cell to not have decimals and I tried to use round and roundup along with and if/then formula but no luck. If it makes any difference, all times are in 24hr format.

Round Up A 24HR Format Time To The Nearest Quarter Of An Hour
Is it possible to round up or down a 24HR time format.

ie. 18:06 would be 18:00
18:28 would be 18:30?

Display Day, Month, Hour & Minutes In Seperate Labels On A Userform
I have made a form with a calender control, a keypad for hours and minutes. I have no problem getting the date from the active cell into a label caption and changing it by the calender, but I am having trouble reading just the hour and minutes into separate label captions from the active cell and changing them via the keypad and updating the active cell at the same time with a new date and time.

Calculate Work Hour Phone Time By Day, Week & Month
I am trying to figure out a way to count the minutes used from 8am-5pm Monday-Friday. I have this years worth of data. I would like to do it by month and by week and by day. I use office 08 for the mac and its my understanding that it doesn't have VBA. I would also like to be able to figure out if on a certain date a employee made over x amount of phone calls in a day. But have several employees. I have columns that are labeled date, employee, minutes used.

If Statement Within If Statement (recognize The Cell)
I'm trying to set up an if statement that will recognize that if a cell is FHR it will do something...but if it's PHR it will do something else. I think I found the place where I keep getting an error but I'm not sure how to go about fixing the issue.

Calculate A 24 Hour Cycle Time Which Excludes Weekends And Public Holidays
I would like to find out if a job took more than 24 hour cycle time (eg. 6:00 am to 5:59:59 AM next day). data:

A1 = received date & time (format "m/d/yyyy h:mm")
B1 = completed date & time (format "m/d/yyyy h:mm")

my formula is '=if(B1-A1>"24:00"+0,"Yes","No"). The problem with the formula is that it doesnt exclude weekends nor public holidays. I couldnt formulate a solution using networkdays function......

Switch Statement Is Too Long For VBA. To Make The Switch Statement Work Over Two Lines
I have created a very long switch statement, which is too long to be placed in one row in VBA. I have attempted to put a space and underscore at the end of one line and continue the statement on the row below by placing a comma at the start of the second line. VBA will accept my efforts, but when I run the statement in the immediate window, the following error appears.

"Invalid procedure call or argument"

I understand that there are certain rules where I can split a switch statement onto two lines, yet I do not know what they may be.