MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 8th, 2002, 05:08 PM   #1
griggsbgsu
New Member
 
Join Date: Mar 2002
Posts: 6
Default

Okay, I'm fairly good with Excel, but I'm no expert. I've ran into a wall and I can't figure out what to do, so hopefully someone can help. Feel free to email me: saragrigsby@yahoo.com

Here is my problem. I have a worksheet setup where I keep track of the hours that I work and the pay I receive. It's worked quite well for the most part, but there is one case that doesn't work.

I have it setup so I enter my clock-in time and my clock-out time and it calculates the number of hours I worked and then calculates my pay and so on. The problem is with calculating the hours that I've worked. I enter my clock-in time in one cell, my clock-out time in another, and here is the formula I use to calculate the hours: =TEXT(B2-A2, "hh:mm"). I enter my times in this format: 5:30 PM for example.

Here is where I run into problems. The formula works fine when my hours are in the same day, for example: 5:30 PM to 10:30 PM. BUT, if my hours are say: 5:30 PM to 12:30 AM, then I get an error in my formula. This happens when my clock-out time runs past 12AM.

I've gotten suggestions to use the 24 hour time format: 15:30, but I'd rather use the standard 12 hour format. I've searched everywhere. I really hope someone has some suggestions for me. Thank you
griggsbgsu is offline   Reply With Quote
Old Mar 8th, 2002, 05:13 PM   #2
Russell Hauf
MrExcel MVP
 
Russell Hauf's Avatar
 
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
Default

Quote:
On 2002-03-08 16:08, griggsbgsu wrote:
Okay, I'm fairly good with Excel, but I'm no expert. I've ran into a wall and I can't figure out what to do, so hopefully someone can help. Feel free to email me: saragrigsby@yahoo.com

Here is my problem. I have a worksheet setup where I keep track of the hours that I work and the pay I receive. It's worked quite well for the most part, but there is one case that doesn't work.

I have it setup so I enter my clock-in time and my clock-out time and it calculates the number of hours I worked and then calculates my pay and so on. The problem is with calculating the hours that I've worked. I enter my clock-in time in one cell, my clock-out time in another, and here is the formula I use to calculate the hours: =TEXT(B2-A2, "hh:mm"). I enter my times in this format: 5:30 PM for example.

Here is where I run into problems. The formula works fine when my hours are in the same day, for example: 5:30 PM to 10:30 PM. BUT, if my hours are say: 5:30 PM to 12:30 AM, then I get an error in my formula. This happens when my clock-out time runs past 12AM.

I've gotten suggestions to use the 24 hour time format: 15:30, but I'd rather use the standard 12 hour format. I've searched everywhere. I really hope someone has some suggestions for me. Thank you
I don't think that the 24 hour format will work for you either (you'll get a negative number). What I suggest, which I'm sure that you'll find to be a pain, is to enter not only the time but the date. I can't see another way around this, sorry.

Somethink like this:

3/8/2002 5:30 PM 3/9/2002 1:00 AM

-rh
Russell Hauf is offline   Reply With Quote
Old Mar 8th, 2002, 05:16 PM   #3
Russell Hauf
MrExcel MVP
 
Russell Hauf's Avatar
 
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
Default

Actually, if you just add 24 to your early morning times it will work (but this would be the 24-hour format you so dread). For example,

6:30 PM 25:00

25:00 being 1 am. Otherwise I think you're going to have to use the date.

Hope I've at least given you some ideas,

Russell
Russell Hauf is offline   Reply With Quote
Old Mar 8th, 2002, 05:19 PM   #4
Barrie Davidson
MrExcel MVP
 
Barrie Davidson's Avatar
 
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
Default

Quote:
On 2002-03-08 16:08, griggsbgsu wrote:
Okay, I'm fairly good with Excel, but I'm no expert. I've ran into a wall and I can't figure out what to do, so hopefully someone can help. Feel free to email me: saragrigsby@yahoo.com

Here is my problem. I have a worksheet setup where I keep track of the hours that I work and the pay I receive. It's worked quite well for the most part, but there is one case that doesn't work.

I have it setup so I enter my clock-in time and my clock-out time and it calculates the number of hours I worked and then calculates my pay and so on. The problem is with calculating the hours that I've worked. I enter my clock-in time in one cell, my clock-out time in another, and here is the formula I use to calculate the hours: =TEXT(B2-A2, "hh:mm"). I enter my times in this format: 5:30 PM for example.

Here is where I run into problems. The formula works fine when my hours are in the same day, for example: 5:30 PM to 10:30 PM. BUT, if my hours are say: 5:30 PM to 12:30 AM, then I get an error in my formula. This happens when my clock-out time runs past 12AM.

I've gotten suggestions to use the 24 hour time format: 15:30, but I'd rather use the standard 12 hour format. I've searched everywhere. I really hope someone has some suggestions for me. Thank you [img]/board/images/smiles/icon_smile.gif[/img]
This formula should work for you:

=TEXT(IF(B1
Regards,

__________________
Barrie Davidson

"You're only given a little spark of madness. You mustn't lose it." - Robin Williams
Barrie Davidson is offline   Reply With Quote
Old Mar 8th, 2002, 05:23 PM   #5
griggsbgsu
New Member
 
Join Date: Mar 2002
Posts: 6
Default

Thanks for the formula, but i entered it and corrected the cell numbers to my correct cell and I still get an error. So, I don't know i'm lost.
griggsbgsu is offline   Reply With Quote
Old Mar 8th, 2002, 05:25 PM   #6
Barrie Davidson
MrExcel MVP
 
Barrie Davidson's Avatar
 
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
Default

Quote:
On 2002-03-08 16:23, griggsbgsu wrote:
Thanks for the formula, but i entered it and corrected the cell numbers to my correct cell and I still get an error. So, I don't know i'm lost.
Cell A1 equals your start time and B1 equals your end time. What was your error (it worked fine for me)? What values were you using to generate the error?


__________________
Barrie Davidson

"You're only given a little spark of madness. You mustn't lose it." - Robin Williams
Barrie Davidson is offline   Reply With Quote
Old Mar 8th, 2002, 05:25 PM   #7
Russell Hauf
MrExcel MVP
 
Russell Hauf's Avatar
 
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
Default

Good one, Barry! That one works for me. B1 should be your second date's cell, and A1 the first. Try it again.

-rh
Russell Hauf is offline   Reply With Quote
Old Mar 8th, 2002, 05:30 PM   #8
griggsbgsu
New Member
 
Join Date: Mar 2002
Posts: 6
Default

Okay I'll give you an example from my sheet.

A1=Time In
B1=Time Out
C1=Formaula: =TEXT(B1-A1, "h:mm")

Okay here is a situation where it works fine.
A1 - 3:15 PM
B1 - 11:22 PM
C1 - Formula result: 8:07
Cool, that works!

Here is a situation where the formula doesn't work.
A1 - 3:50 PM
B1 - 12:38 AM
C1 - Formaul result: VALUE!
Okay, that doesn't work.
These are right from my sheet so if they work for someone else I must be doing something really wrong.
griggsbgsu is offline   Reply With Quote
Old Mar 8th, 2002, 05:31 PM   #9
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Or...

=TEXT(B2-A2+(B2
Mark W. is offline   Reply With Quote
Old Mar 8th, 2002, 05:32 PM   #10
Barrie Davidson
MrExcel MVP
 
Barrie Davidson's Avatar
 
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
Default

Quote:
On 2002-03-08 16:30, griggsbgsu wrote:
Okay I'll give you an example from my sheet.

A1=Time In
B1=Time Out
C1=Formaula: =TEXT(B1-A1, "h:mm")

Okay here is a situation where it works fine.
A1 - 3:15 PM
B1 - 11:22 PM
C1 - Formula result: 8:07
Cool, that works!

Here is a situation where the formula doesn't work.
A1 - 3:50 PM
B1 - 12:38 AM
C1 - Formaul result: VALUE!
Okay, that doesn't work.
These are right from my sheet so if they work for someone else I must be doing something really wrong.
Put this formula in C1

=TEXT(IF(B1

__________________
Barrie Davidson

"You're only given a little spark of madness. You mustn't lose it." - Robin Williams
Barrie Davidson is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 01:32 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes