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 May 1st, 2002, 06:29 AM   #1
paulrus
New Member
 
Join Date: Apr 2002
Posts: 15
Default

Hi all,

I am using the following formula for conditional formatting:

=COUNTIF($A$70:$A$84,$E5)

It checks to see if E5 (actually every cell in E) matches A70-84 and if so it changes the format. A70-84 contains a list of state abbreviations & it works great. However, now I want to change the information that the changes the formatting.

Instead of state abbreviations, I want the formatting to change IF there is a DATE being held in the cells in E. It doesn't matter what the date is, just that it is a date. Any other data should be ignored.

Any pointers on this one?

Thanks!

Paul
paulrus is offline   Reply With Quote
Old May 1st, 2002, 08:05 AM   #2
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,388
Default

OK, here is my shot at this, although I bet someone may suggest a more efficient formula. This worked for me in most cases (see below for details):

=IF(LEN(A70)<5,"",OR(WEEKDAY(A70)=1,WEEKDAY(A70)=2,WEEKDAY(A70)=3,WEEKDAY(A70)=4,WEEKDAY(A70)=5,WEEKDAY(A70)=6,WEEKDAY(A70)=7))

Then copy as needed.

The LEN condition refers to the minimal 5 digit date serial number.

This formula is not perfect, in that if a 6 or 7 digit number is entered, Excel may regard that as a date also and conditionally format the cell, even if your intention for that value is not to have it represent a date, even if you precede it with an apostrophe. It will not format the cell for a value less than 5 characters in length (even if all are digits), nor will it format if an 8-digit value is entered.

Except for those restrictions, does this help? I bet someone will show me where this formula could be improved.

It's do-able with VBA also.

I'd be interested in anyone's suggestion for a tighter conditional format formula solution, but hopefully this may get you started.

Any help?

_________________
Tom Urtis

[ This Message was edited by: Tom Urtis on 2002-05-01 07:09 ]
Tom Urtis is offline   Reply With Quote
Old May 1st, 2002, 08:30 AM   #3
Steve Hartman
Board Regular
 
Steve Hartman's Avatar
 
Join Date: Feb 2002
Location: Houston,Texas
Posts: 418
Default

It's fairly simple as long as you dates aren't in a custom format.

=AND(LEFT(CELL("format",E1),1)="D",RIGHT(CELL("format",E1),1)*1<6) checks E1 for a standard date format.

[ This Message was edited by: Steve Hartman on 2002-05-01 08:10 ]
Steve Hartman is offline   Reply With Quote
Old May 1st, 2002, 08:40 AM   #4
paulrus
New Member
 
Join Date: Apr 2002
Posts: 15
Default

=IF(LEN(A70)<5,"",OR(WEEKDAY(A70)=1,WEEKDAY(A70)=2,WEEKDAY(A70)=3,WEEKDAY(A70)=4,WEEKDAY(A70)=5,WEEKDAY(A70)=6,WEEKDAY(A70)=7))

This works, but only to change the date to a different format, not to convert the entire row to a different format. What happens is Excel automagically changes the row letter so the formula applies to individual cells in a row rather than the entire row - A70, B70, C70, etc. (I'm a newbie, so I'm assuming this is a simple fix)

Paul
paulrus is offline   Reply With Quote
Old May 1st, 2002, 09:07 AM   #5
Tom Urtis
MrExcel MVP
 
Tom Urtis's Avatar
 
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,388
Default

Sorry, I did not gather from your original question that you wanted other cells in the same row formatted, depending on the existence of a date in column A of that given row.

No problem though, just use this modified formula and copy the conditional formatting to the cells of your choice:

=IF(LEN($A70)<5,"",OR(WEEKDAY($A70)=1,WEEKDAY($A70)=2,WEEKDAY($A70)=3,WEEKDAY($A70)=4,WEEKDAY($A70)=5,WEEKDAY($A70)=6,WEEKDAY($A70)=7))

Is that what you want?
__________________
Tom Urtis
Microsoft MVP - Excel
Tom Urtis is offline   Reply With Quote
Old May 1st, 2002, 10:52 AM   #6
paulrus
New Member
 
Join Date: Apr 2002
Posts: 15
Default

Thanks Tom!

Yes that is exactly what I wanted. So, (warning warning newbie comment) the $ in front of the letter is what keeps it from automatically moving up a letter? My company has Office on every machine but no manual, no training, nothing - I know it a bit, but when it comes to doing things like formatting, etc., I'm lost.

Thanks again!

Paul
paulrus 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 02:05 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