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 Apr 17th, 2002, 10:16 AM   #1
jennfurr
New Member
 
Join Date: Apr 2002
Posts: 24
Default

I'll try to explain. I have two columns of military time (FROMTIME and TOTIME)

I have other columns within the same sheet titled 0000-0059, 0100-0159, 0200-0259, etc.

What I need to do is based on the FROMTIME and TOTIME is to place an X in the appropriate columns.

For example, if the FROMTIME is 1045 and the TOTIME is 1200, I need an X placed in the 1000-1059 column and the 1100-1159 column (not the 1200-1259 column, because the incident didn't potentially happen during that "hour span" - that's a management thing, long story).

Also, if an incident occurrs from 2300-0145, I need to be able to put the x in the last column (2300-2359) and the first column (0000-0059).

Is this do-able or is it another "can you total this diagonally for me?" type question?
jennfurr is offline   Reply With Quote
Old Apr 17th, 2002, 12:52 PM   #2
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

What's the data type of FROMTIME and TOTIME?
Mark W. is offline   Reply With Quote
Old Apr 17th, 2002, 01:29 PM   #3
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Consider this where A1:F4 contains...

{"FROMTIME","TOTIME","0000-0059","0100-0159","0200-0259","0300-0359"
;"0025","0101","X","X","",""
;"0133","0301","","X","X","X"
;"0145","0300","","X","X",""}

...and cell C2 (the 1st "X" above) contains the formula...

=IF(AND($A2>=LEFT(C$1,4),$A2<=RIGHT(C$1,4)),"X",IF(AND($B2>LEFT(C$1,4),$A2<=RIGHT(C$1,4)),"X",""))

...which is filled right to column F:F and filled down to row 4:4.

[ This Message was edited by: Mark W. on 2002-04-17 12:31 ]
Mark W. is offline   Reply With Quote
Old Apr 17th, 2002, 01:33 PM   #4
jennfurr
New Member
 
Join Date: Apr 2002
Posts: 24
Default

I do it one of two ways -

Formatted as a custom type "0000", or as time in hh:mm format "14:35"

I get the information in a data dump from a mainframe, which gets read as a number field, and I usually have that transferred as =(LEFT,a2,2)&":"&(RIGHT,A2,2) into a time formatted field.

It just depends if I'm going to be fiddling with time calculations or not. So I'm flexible. If one way makes it easier than the other, then I'll do it that way.
jennfurr is offline   Reply With Quote
Old Apr 17th, 2002, 01:46 PM   #5
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

I'm guessing that you missed my reply above. Take a look!
Mark W. is offline   Reply With Quote
Old Apr 17th, 2002, 01:51 PM   #6
jennfurr
New Member
 
Join Date: Apr 2002
Posts: 24
Default

heh, I replied while you were replying, I think

Anyway, that WORKED! Thank you!!!!!

Usually, it's Aladin who gives me the only concise, working solution.

You rool. I figured out what half of that formula means, now I just have to figure out the rest of it all that embedding. I'll get it, eventually...
jennfurr is offline   Reply With Quote
Old Apr 17th, 2002, 01:54 PM   #7
jennfurr
New Member
 
Join Date: Apr 2002
Posts: 24
Default

oops! if I put in FROMTIME 2345 and TOTIME 0125, it doesn't work

Seem like it can't handle wrapping from one "day" to the next.
jennfurr is offline   Reply With Quote
Old Apr 17th, 2002, 02:28 PM   #8
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Quote:
On 2002-04-17 12:54, jennfurr wrote:
oops! if I put in FROMTIME 2345 and TOTIME 0125, it doesn't work

Seem like it can't handle wrapping from one "day" to the next.
I overlooked that "last" requirement. Let me see what I can do.

[ This Message was edited by: Mark W. on 2002-04-17 13:28 ]
Mark W. is offline   Reply With Quote
Old Apr 17th, 2002, 03:23 PM   #9
Mark W.
MrExcel MVP
 
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
Default

Okay, try this in cell C2 (following the same instructions as above)...


=IF(AND($A2>=LEFT(C$1,4),$A2<=RIGHT(C$1,4)),"X",
IF(AND($B2>LEFT(C$1,4),$A2<=RIGHT(C$1,4)),"X",
IF(AND($A2>$B2,$A2<=RIGHT(C$1,4)),"X",
IF(AND($A2>$B2,OR(LEFT(C$1,4)="0000",RIGHT(C$1,4)="2359")),"X",""))))
Mark W. is offline   Reply With Quote
Old Apr 17th, 2002, 03:44 PM   #10
jennfurr
New Member
 
Join Date: Apr 2002
Posts: 24
Default

almost works...

when I put in something like 2200-0058, that works, but when i put in 2200-0700, it only captures the 2200-2259, 2300-2359, and 0000-0059 columns. It didn't get the other columns up to 0600-0659.

jennfurr 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 07:55 AM.


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