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 Feb 22nd, 2002, 02:29 PM   #1
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

Please help with this formula.
Year is in $AE$2
Month is in $A5, $A7, $A9... and is 3 characters text as JAN, FEB, MAR...
Day (1 - 31) is in B$4:AF$4
I want to conditionally format every cell (B5:AF27) if date (obtained using INDIRECTs) is Sat, Sun or invalid (April 31st). For example, X7 would be shaded because it is Feb 23, 2002 which is Saturday. Many thanks.
pilot is offline   Reply With Quote
Old Feb 22nd, 2002, 06:11 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-02-22 13:29, pilot wrote:
Please help with this formula.
Year is in $AE$2
Month is in $A5, $A7, $A9... and is 3 characters text as JAN, FEB, MAR...
Day (1 - 31) is in B$4:AF$4
I want to conditionally format every cell (B5:AF27) if date (obtained using INDIRECTs) is Sat, Sun or invalid (April 31st). For example, X7 would be shaded because it is Feb 23, 2002 which is Saturday. Many thanks.
Don't know why you need INDIRECT...
If you put the numbers 1-12 in your MONTH cells, and format as "mmm", you can use the DATE function for your dates. At any rate, here is a formula you can use for conditional formatting:

=MOD(WEEKDAY(B5),7)<=1

Let me know if you can't get it to work and I can send you an example (most likely Monday, however).

Have a good weekend,

Russell
Russell Hauf is offline   Reply With Quote
Old Feb 22nd, 2002, 07:47 PM   #3
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

Please help with this formula.
Year is in $AE$2
Month is in $A5, $A7, $A9... and is 3 characters text as JAN, FEB, MAR...
Day (1 - 31) is in B$4:AF$4
I want to conditionally format every cell (B5:AF27) if date (obtained using INDIRECTs) is Sat, Sun or invalid (April 31st). For example, X7 would be shaded because it is Feb 23, 2002 which is Saturday. Many thanks.


--------------------------------------------------------------------------------



Don't know why you need INDIRECT...
If you put the numbers 1-12 in your MONTH cells, and format as "mmm", you can use the DATE function for your dates. At any rate, here is a formula you can use for conditional formatting:

=MOD(WEEKDAY(B5),7)<=1

Let me know if you can't get it to work and I can send you an example (most likely Monday, however).

Have a good weekend,

Russell
--------------------------------------------

Don't think this will work. B5 corresponds to JAN (Row 5) 1 (Col B) but the cell is empty (or has text in it), not the date. That's why I thought INDIRECT was required.

I knew I could change month from text to mmm formatted 1-12 but I'm trying to use data exactly as it has been provided to me, therefore prefer to make the formula handle JAN to 1, etc.
pilot is offline   Reply With Quote
Old Feb 23rd, 2002, 11:25 AM   #4
Russell Hauf
MrExcel MVP
 
Russell Hauf's Avatar
 
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
Default

If you have your dates (however you have created them) in cells B5-whatever, then you can use the conditional format formula that I provided. If you can't get it to work, send me the workbook (or a sample) and I can get to it on Monday or Tuesday.

-rh
Russell Hauf is offline   Reply With Quote
Old Feb 23rd, 2002, 07:27 PM   #5
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

Dates are not in B5:AF27. Months are in Col A and days of the month are in Row 4. Any date in the year is inferred by the Row/Col intersection, i.e. Row 7 is Feb, Col X is day 23 so X7 corresponds to 02-23-02. Appreciate your continued help. Can send file if still needed.

[ This Message was edited by: pilot on 2002-02-23 18:29 ]
pilot is offline   Reply With Quote
Old Feb 24th, 2002, 01:37 PM   #6
pilot
Board Regular
 
Join Date: Feb 2002
Location: Houston, TX
Posts: 303
Default

I figured it out, all but two aspects. Here's the Conditional Format formula in B5 (sets shaded background) if Sat or Sun.

=WEEKDAY(DATE($AE$2,MONTH($A5),B$4),2)>5

I did change JAN text to 1, etc. Also, invalid dates in my grid are treated as valid dates in next month (Apr 31 translates to May 1). Will post these a new questions. Thanks, Russell.
pilot is offline   Reply With Quote
Old Feb 25th, 2002, 12:40 PM   #7
Russell Hauf
MrExcel MVP
 
Russell Hauf's Avatar
 
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
Default

Quote:
On 2002-02-24 12:37, pilot wrote:
I figured it out, all but two aspects. Here's the Conditional Format formula in B5 (sets shaded background) if Sat or Sun.

=WEEKDAY(DATE($AE$2,MONTH($A5),B$4),2)>5

I did change JAN text to 1, etc. Also, invalid dates in my grid are treated as valid dates in next month (Apr 31 translates to May 1). Will post these a new questions. Thanks, Russell.
The only thing is that the weekdays for Saturday and Sunday are 7 and 1, respectively.
Russell Hauf is offline   Reply With Quote
Old Feb 25th, 2002, 12:50 PM   #8
Aladin Akyurek
MrExcel MVP
 
Aladin Akyurek's Avatar
 
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
Default

Quote:
On 2002-02-25 11:40, Russell Hauf wrote:
Quote:
On 2002-02-24 12:37, pilot wrote:
I figured it out, all but two aspects. Here's the Conditional Format formula in B5 (sets shaded background) if Sat or Sun.

=WEEKDAY(DATE($AE$2,MONTH($A5),B$4),2)>5

I did change JAN text to 1, etc. Also, invalid dates in my grid are treated as valid dates in next month (Apr 31 translates to May 1). Will post these a new questions. Thanks, Russell.
The only thing is that the weekdays for Saturday and Sunday are 7 and 1, respectively.
Russell,

As a side-effect of a question pilot posted under the title "Invalid dates", I also took up (or rather "dragged into") this cond format question. See that post.

BTW, you can give an additional param to weekday, e.g., 2, to get a different numbering of days.

Regards,

Aladin
Aladin Akyurek 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:01 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