Office & Productivity Software forum

General discussion

Excel Timesheet formula ~In/Out for Lunch~

by BigMike / January 1, 2005 7:00 AM PST

I'm using this formula: =(C7-B7+(C7<B7))*24
Of course the columns and rows vary. I want to have a column for lunch. I want a column for the time spent at lunch. Then have the total daily presented with lunch subtracted.

Mike

Discussion is locked
You are posting a reply to: Excel Timesheet formula ~In/Out for Lunch~
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Excel Timesheet formula ~In/Out for Lunch~
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
That won't work
by MarkFlax Forum moderator / January 1, 2005 8:06 PM PST

If I understand you properly, you are trying to set up a formula that will calculate how many hours you have worked during the day, "less" the time you spent out to lunch. In which case the formula needs an "out/in" function, not an "in/out" function.

Look at it this way. You have 5 columns, with 5 headers, A5 - B5 - C5 - D5 and E5.

The headers are;

Start time - Begin Lunch - End lunch - End time - Total worked.

In A7 is 08:00
In B7 is 12:00
In C7 is 13:00
In D7 is 17:00
In E7 is the result of the calculation giving you the time you worked, "less" the time you spent at lunch.

In the formula you gave, (C7<B7) always fails because C7 can never be smaller than B7. You cannot end your lunch before you begin it.

Also, the * 24 does not give any meaningful answer. It multiplies any result by 24, but what you want, (if I understand this correctly), is how many hours you worked during the day.

So, you need to take the End time and subtract the Start time, then from the result, take away the time spent at lunch, (which will be the End lunch minus the Begin lunch).

ie, you need D7-A7, gives total time at work, less (C7-B7), gives the time you worked, less your lunch time.

eg E7 =(D7-A7-(C7-B7))

Is this what you mean?

Incidently, each cell needs formatting, under the Numbers tab, to "Number" with 2 decimal places.

Mark

Collapse -
example
by BigMike / January 2, 2005 7:34 AM PST
In reply to: That won't work

Col B is "In" to work Col C is "Out" finished work. Everything is on 24 hr clock, no am or pm. I would like a col D "Lunch" in minutes or fractions of hour.

B is 0800 arrive at work
C is 1700 leave for the day.
D is 0.50 for lunch
E is 8.5 hours worked

Again I want everything to be on 24 hour clock.

M

Collapse -
What's your problem?
by Kees Bakker / January 2, 2005 4:27 PM PST
In reply to: example

I take an empty spreadsheet. Then I fill in

A1: 08:00
B1: 17:00
C1: 0:30
D1: =B1-A1-C1 automatically becomes 8:30

Excel XP does automatic formatting to h:mm (using the Dutch version it's u:mm, but I assume hours are h in English). Anyway, it's automatic, so you can have a look what it should be.

There might be complications with a midnight lunch, but that's not a probable thing to happen.

Hope this helps.


Kees

Collapse -
Ahhh, I now see the problem
by MarkFlax Forum moderator / January 2, 2005 8:56 PM PST
In reply to: What's your problem?

A light finally shone in my head.

The problem is the figure entered in as the time taken for lunch.

Using Kees example above,

A1 = a time
B1 = a time, but
C1 = a number, (of minutes).

So, each of the cells A1, B1 and C1 must be formatted as either Time, or Custom, (hh:mm).

Then D1 =B1-A1-C1, and D1 must also be formatted as a Time, or as Custom, (hh:mm).

And, as Swisse has said, you must enter each number in the format 00:00, eg hours:minutes, so a 25 minute lunch break becomes 00:25

So, back to your original request,

B7 =time started work, in the format hh:mm
C7 =time finished work in the format hh:mm
D7 =time spent having lunch, hh:mm

then E7 =C7-B7-D7

Highlight all the cells and right click. Select "Format cells"and in the Format Cells dialogue, select "Custom" from the list on the left.

Then, under the "Type" heading on the right, delete any entry, and type in "hh:mm" (without the quotation marks), then click OK.

You could just format the cells as "Time", but this gives results in the hh:mm:ss format.

Hope this helps.

Mark

Collapse -
TimeSheet
by swisse / January 2, 2005 8:15 PM PST

Hello Mike,
Instead of writing your times for example 0800 for 8 o'clock write it this way 08:00 so that Excel recognizes it as a time value, otherwise it interprets it as just a numerical value and you will just have computation errors.

Now your formula for E7 should look like this :
=((C7-B7+(C7<B7))-D7)*24

Hope this is what you meant, otherwise tell me.

Swisse

Collapse -
DOH
by BigMike / January 3, 2005 9:45 AM PST
In reply to: TimeSheet

Thanks all


Format was what I over looked.

Formated to the time format with other cells all is ok now.

New formula (excel automated the formula) because I put lunch between out from work and daily total.

=(C7-D7-B7+(C7<B7))*24

B is in to work
C is out from work
D is time spent at lunch format is hh:mm

Again thanks all


Mike

Collapse -
Glad we could help
by MarkFlax Forum moderator / January 4, 2005 1:08 AM PST
In reply to: DOH

and thanks for posting back.

Mark

Popular Forums
icon
Computer Help 49,613 discussions
icon
Computer Newbies 10,349 discussions
icon
Laptops 19,436 discussions
icon
Security 30,426 discussions
icon
TVs & Home Theaters 20,308 discussions
icon
Windows 10 360 discussions
icon
Phones 15,802 discussions
icon
Windows 7 7,351 discussions
icon
Networking & Wireless 14,641 discussions

Smartphone tip

Hoarding photos on your phone?

Those picture are hogging memory and could be slowing down your phone.