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 30th, 2004, 08:37 PM   #1
ambra19
 
Join Date: May 2003
Posts: 40
Default Listing Business Days in a column based on Month selected

My spreadsheet has a dropdown box where I can select the month and it will update Rows 6 thru 27 with business days only. It will also underline the Friday date (from Columns A-G) or the last day. It will also remove the underline for the previous month.
ie
April 2004 selected:
Apr 1/04
Apr 2/04 - underline
Apr 5/04
Apr 6/04
Apr 7/04
Apr 8/04
Apr 9/04 - underline
etc.

If any further clarification is required, please let me know.
Regards,
Karim
ambra19 is offline   Reply With Quote
Old Mar 30th, 2004, 09:00 PM   #2
texasalynn
 
texasalynn's Avatar
 
Join Date: May 2002
Location: Houston, TX
Posts: 5,479
Default Re: Listing Business Days in a column based on Month selecte

Not exactly sure what your question is. Are you trying to find a way to get the Friday's underlined? If so use the conditional format and weekday formula. In the conditional format make it =WEEKDAY($A2,2)=5 and choose the format to underline.

HTH
texasalynn
texasalynn is offline   Reply With Quote
Old Mar 30th, 2004, 09:14 PM   #3
ambra19
 
Join Date: May 2003
Posts: 40
Default Re: Listing Business Days in a column based on Month selecte

I would like it to automatically list all of the eligible work dates in Column A when I select a particular month.
I don't want to have to type out the dates:

Apr 1/04
Apr 2/04
Apr 5/04
Apr 6/04
Apr 7/04

Thanks.
ambra19 is offline   Reply With Quote
Old Mar 30th, 2004, 09:22 PM   #4
IML
MrExcel MVP
 
Join Date: Feb 2002
Location: Denver, CO
Posts: 1,744
Default Re: Listing Business Days in a column based on Month selecte

assuming your drop down date (as text) is in cell a1, you could use
=WORKDAY(A1-1,1)
in cell A6
in a7 type
=IF(ISNUMBER(A6),IF(MONTH(WORKDAY(A6,1))=MONTH(--$A$1),WORKDAY(A6,1),""),"")
and copy down a goodly # of rows. Conditional formatting can be applied to these dates as suggested.
IML is offline   Reply With Quote
Old Mar 30th, 2004, 09:27 PM   #5
texasalynn
 
texasalynn's Avatar
 
Join Date: May 2002
Location: Houston, TX
Posts: 5,479
Default Re: Listing Business Days in a column based on Month selecte

I did this - and so each time I type in a different date in A2 it automatically changes the dates.

******** ******************** ************************************************************************>
Microsoft Excel - Book2___Running: xl2000 : OS = Windows 98
(F)ile (E)dit (V)iew (I)nsert (O)ptions (T)ools (D)ata (W)indow (H)elp (A)bout
=

A
B
C
D
1
Jan-04***
2
01/01/04***
3
01/02/04***
4
01/05/04***
5
01/06/04***
6
01/07/04***
7
01/08/04***
8
01/09/04***
9
01/12/04***
10
01/13/04***
11
01/14/04***
12
01/15/04***
13
01/16/04***
14
01/19/04***
15
01/20/04***
16
01/21/04***
17
01/22/04***
18
01/23/04***
19
01/26/04***
20
01/27/04***
21
01/28/04***
22
01/29/04***
23
01/30/04***
Sheet1*

[HtmlMaker 2.42] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.


HTH
texasalynn
texasalynn is offline   Reply With Quote
Old Mar 30th, 2004, 09:31 PM   #6
Joe4
MrExcel MVP
Moderator
 
Joe4's Avatar
 
Join Date: Aug 2002
Posts: 14,220
Default Re: Listing Business Days in a column based on Month selecte

This is somewhat similar to IML, but it is a little different, so I will post it anyway.

Enter the first day of the month in A1, the in B1 enter this formula and copy down 23 times:
=IF(MONTH(WORKDAY($A$1-1,ROW()))=MONTH($A$1),WORKDAY($A$1-1,ROW()),"")

Note that I am making use of ROW(), which returns the current row number. It will also automatcially take care of the situation in which there are less than 23 workdays in a month.
__________________
TIPS FOR FINDING EXCEL SOLUTIONS
1. Use the built-in Help that comes with Excel/Access
2. Use the Search functionality on this board
3. A lot of VBA code can be acquired by using the Macro Recorder.
Joe4 is offline   Reply With Quote
Old Mar 30th, 2004, 09:34 PM   #7
ambra19
 
Join Date: May 2003
Posts: 40
Default Re: Listing Business Days in a column based on Month selecte

I tried both suggestions and have received a #NAME? error.
What am I missing?
The help is greatly appreciated.
ambra19
ambra19 is offline   Reply With Quote
Old Mar 30th, 2004, 09:38 PM   #8
Joe4
MrExcel MVP
Moderator
 
Joe4's Avatar
 
Join Date: Aug 2002
Posts: 14,220
Default Re: Listing Business Days in a column based on Month selecte

The EOMONTH and WORKDAY functions require the Analysis Tool-Pak Add-in to be installed. Many times, it will be installed and just needs to be selected (Tools | Add-ins | ...)
__________________
TIPS FOR FINDING EXCEL SOLUTIONS
1. Use the built-in Help that comes with Excel/Access
2. Use the Search functionality on this board
3. A lot of VBA code can be acquired by using the Macro Recorder.
Joe4 is offline   Reply With Quote
Old Mar 30th, 2004, 09:51 PM   #9
ambra19
 
Join Date: May 2003
Posts: 40
Default

I activate the Add-In.
The EOMONTH is close to working in that the month gets changed rather than the day.
The other version:
=IF(MONTH(WORKDAY($A$1-1,ROW()))=MONTH($A$1),WORKDAY($A$1-1,ROW()),"")
The first I get is 38078 followed by #VALUE? in every row thereafter in Column B. If I copy this under the Date in A1, I get 38078 followed by increments of one as the rows increase.

Thanks again for all of the help.
ambra19
ambra19 is offline   Reply With Quote
Old Mar 30th, 2004, 10:19 PM   #10
Joe4
MrExcel MVP
Moderator
 
Joe4's Avatar
 
Join Date: Aug 2002
Posts: 14,220
Default Re: Listing Business Days in a column based on Month selecte

38078 IS your date. Excel stores all dates as numbers. You simply need to format the column as dates and everything will look as you want it to.
__________________
TIPS FOR FINDING EXCEL SOLUTIONS
1. Use the built-in Help that comes with Excel/Access
2. Use the Search functionality on this board
3. A lot of VBA code can be acquired by using the Macro Recorder.
Joe4 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 +1. The time now is 05:15 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.