Need A formula in VBA ,Similar to NETWORKDAYS in excel

I would like to get only working days after excluding satuday and sunda
and holidays. Holidays will be there in the range of sheet

There is one formula in xls (NETWORKDAYS) , It would be appreciated i
you can make it similar one. The format of NETWORKDAYS is
NETWORKDAYS(STARTDATE,ENDDATE,HOLIDAY-RANGE)

Regards
Joph

--
Message posted from http://www.ExcelForum.com

0
1/13/2004 4:03:12 AM
excel 39879 articles. 2 followers. Follow

7 Replies
558 Views

Similar Articles

[PageSpeed] 10

On Mon, 12 Jan 2004 22:03:12 -0600, jophy <<jophy.zycba@excelforum-nospam.com>>
wrote:

>I would like to get only working days after excluding satuday and sunday
>and holidays. Holidays will be there in the range of sheet
>
>There is one formula in xls (NETWORKDAYS) , It would be appreciated if
>you can make it similar one. The format of NETWORKDAYS is 
>NETWORKDAYS(STARTDATE,ENDDATE,HOLIDAY-RANGE)
>
>Regards
>Jophy
>
>
>---
>Message posted from http://www.ExcelForum.com/

Well, you could use NETWORKDAYS in VBA by referencing the Analysis Tool Pak.


--ron
0
1/13/2004 4:24:55 AM
Ron,
Thanks for youimmediate reply. I have tried to use networkday
in VB but it is giving error as "Not supported this function" eve
after installing add-in .. it would great if you can ellaborate on thi
,how to use ,what would be the syntax in VB to use networkdays??

--
Message posted from http://www.ExcelForum.com

0
1/13/2004 1:31:18 PM
Hi Jophy!

Here's a useless UDF that uses it:

Function DaysDiff(StartDay As Date, EndDay As Date, Hols As Range)
DaysDiff = networkdays(StartDay, EndDay, Hols)
End Function

I can then use:

=daysdiff(A1,B1,MyHolidays)

But before you can use the Analysis ToolPak functions in VBA you need
to do two things:

1. In Excel as opposed to the VBE you must Install Analysis ToolPak -
VBA using the Tools > Addins route
2. For the VBA project you need to use:
Tools > References
Put checks against ATPVBAEN.XLA and FUNCRES.XLA

You'll then see these listed under References in the Project Explorer
window.

-- 
Regards
Norman Harker MVP (Excel)
Sydney, Australia
njharker@optusnet.com.au
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


0
njharker (1646)
1/13/2004 1:52:18 PM
On Tue, 13 Jan 2004 07:31:18 -0600, jophy <<jophy.zz2m4@excelforum-nospam.com>>
wrote:

>Ron,
>Thanks for youimmediate reply. I have tried to use networkdays
>in VB but it is giving error as "Not supported this function" even
>after installing add-in .. it would great if you can ellaborate on this
>,how to use ,what would be the syntax in VB to use networkdays???
>
>
>---
>Message posted from http://www.ExcelForum.com/

In the VB editor, you select, from the main menu bar:  Tools/References and
then select atpvbaen.xls from the list.  That is the analysis toolpak.

Once you have done this, then, in the module, you can use networkdays as any
other built-in vb function.

You can tell you did it correctly if the arguments pop up when you insert the
function.

For example:

  Nwd = NETWORKDAYS(START_DATE, END_DATE, HOLIDAYS)


--ron
0
1/13/2004 3:52:04 PM
Thanks Verymcu

--
Message posted from http://www.ExcelForum.com

0
1/14/2004 4:12:33 AM
Just be aware of the huge bug Microsoft left in the atpvbaen.xls.  This is
for Excel xp, and I'm afraid, Excel 2003.  When one has a vba library
reference to "Tools/References and then atpvbaen.xls, any calls to a
function writes debug statements to the immediate window. (More importantly,
also custom functions).  This renders your own Debug.Print statements
useless, as they will be scrolled out of view.  Additionally, this will slow
your programs down by a factor of between 20-40.

A simple program like this..

nwDays = Networkdays(#1/1/2004#, Date)

writes the following to the immediate window:

[GetMacroRegId] 'NETWORKDAYS' <
[GetMacroRegId] 'NETWORKDAYS' -> '823263288' >

Just thought I would mention this as it is very confusing the first time you
see it.  It's not you.  It's the program.  This may not be a real problem
with just 1 call, but on a large engineering sheet, this is a problem.  It
is my understanding that Microsoft may be looking into this.  Let's hope!
:>)

-- 
Dana DeLouis
Using Windows XP  &  Office XP
= = = = = = = = = = = = = = = = =


"jophy >" <<jophy.1007ev@excelforum-nospam.com> wrote in message
news:jophy.1007ev@excelforum-nospam.com...
> Thanks Verymcuh

> Message posted from http://www.ExcelForum.com/


0
delouis (422)
1/14/2004 1:27:22 PM
Hi Dana!

I've reported the bug and have received a confirmation that Microsoft
are (at last!) looking into it.

It's been around since Excel 2002 and hopefully the next patch or
service Release will fix it as it appears to be only a case of
removing their debug statements.

-- 
Regards
Norman Harker MVP (Excel)
Sydney, Australia
njharker@optusnet.com.au
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
"Dana DeLouis" <delouis@bellsouth.net> wrote in message
news:%23aTGAJq2DHA.484@TK2MSFTNGP10.phx.gbl...
> Just be aware of the huge bug Microsoft left in the atpvbaen.xls.
This is
> for Excel xp, and I'm afraid, Excel 2003.  When one has a vba
library
> reference to "Tools/References and then atpvbaen.xls, any calls to a
> function writes debug statements to the immediate window. (More
importantly,
> also custom functions).  This renders your own Debug.Print
statements
> useless, as they will be scrolled out of view.  Additionally, this
will slow
> your programs down by a factor of between 20-40.
>
> A simple program like this..
>
> nwDays = Networkdays(#1/1/2004#, Date)
>
> writes the following to the immediate window:
>
> [GetMacroRegId] 'NETWORKDAYS' <
> [GetMacroRegId] 'NETWORKDAYS' -> '823263288' >
>
> Just thought I would mention this as it is very confusing the first
time you
> see it.  It's not you.  It's the program.  This may not be a real
problem
> with just 1 call, but on a large engineering sheet, this is a
problem.  It
> is my understanding that Microsoft may be looking into this.  Let's
hope!
> :>)
>
> -- 
> Dana DeLouis
> Using Windows XP  &  Office XP
> = = = = = = = = = = = = = = = = =
>
>
> "jophy >" <<jophy.1007ev@excelforum-nospam.com> wrote in message
> news:jophy.1007ev@excelforum-nospam.com...
> > Thanks Verymcuh
>
> > Message posted from http://www.ExcelForum.com/
>
>


0
njharker (1646)
1/14/2004 2:05:09 PM
Reply:

Similar Artilces:

Excel 1997
I know, I know...... It's time to upgrade my microsoft office software, but right now I can't afford it. So I'm stuck still using my Office '97 edition. Anyway, I was wondering if there was any way to hide the contents of a specific cell so that when I printed the page the contents would not be seen. Does anyone know how I might go about doing that? Thx. You could change the colour of the characters in that cell to white, but don't forget to change it back or you will never see it on screen. -- Ken Russell kenrussellyourhat@optushome.com.au Remove yourhat to reply b...

Not sure if Excel can do what i need
Hello all, I am obviously a new user to excel. I have a psychological assessmen that needs to be computerised for ease of use in obtaining results. Here is what i would like to happen. I have 28 questions with fiv Likert scale options(0-4) for answers. Each question addresses 1 of different personality traits. So questions 1, 6, 8, 22 look at anger. Where as questions 2, 9, 28 look at happiness. What i would like is fo excel to group the answers and give me the total number for each trait. Then based on that number, give out a prewritten (which i would provide result of the assessment. ...

Need Min Value from Row and Heading Value that Corresponds to it.
I have a table that looks somewhat like this w/o the *'d headings: h1 h2 h3 h4 h5 h6 h7 *Min Price *Heading $5.00 $6.00 $3.00 $4.00 $9.00 $1.00 $9.00 $1.00 h6 $3.00 $6.00 $8.00 $65.00 $9.00 $2.00 $4.00 $2.00 h6 $4.00 $9.00 $5.00 $7.00 $1.00 $2.00 $8.00 $1.00 h5 $9.00 $7.00 $6.00 $3.00 $9.00 $8.00 $2.00 $2.00 h7 $7.00 $8.00 $9.00 $7.00 $9.00 $8.00 $8.00 $7.00 h1 I have several SKU's with various price contract/programs. I want to find the best price in one cell and the heading that would correspond to that cell in another. I was trying to do this with an expression ...

How do I plot Excel data on a floorplan?
I'm trying to find a way to plot data from an Excel worksheet on a floorplan diagram. The data reflects room assignments for a hospital, so some data stays the same for days while other data changes on a twice a day basis. I want to enable someone to be able to enter the data on the worksheet and have excel output the names, etc in the proper room assignments on the floorplan automatically. The users could then print this floorplan to locate the assignments more easily. I can either scan a hardcopy of the floorplan, or I have access to Visio so I could also quickly construct a d...

Excel need help
I have 2 columns a and b . a contains payment b contains balance. I have the entire col b with the formula. my ? is when the balance appearsin b it is in all the cells in that column.I only want it in the used ones, not the unused ones:( example $270.00 16,730.00 $270.00 16,460.00 $100.00 16,360.00 $300.00 16,060.00 $270.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 15,790.00 this 15790.00 is in col b...not a...I want no bal in unused cells -- fiftieslady ------------------------------------------------------------------------ fiftieslady's Profile: http://www.excelforum.co...

excel charts converted into pdf
Hello, I'm experiencing the following issue: I have a handful of charts in Excel that I inserted into Word and then converted the entire word document into PDF format using Acrobat Professional. Resulting PDF has black vertical bars in place of vertical text next to X-axis and title of the Y-axis. Converting charts into PDF directly from Excel does not produce this problem. However I must use Word doc. I have XP SP3,MS Office 2003 and Acrobat Professional 7.0. Any help is much appreciated. Thanks I've had this happen to me, too, on occasion. Not real often, fortunately. When I lo...

Need Help Linking Sheets
How can I link 2 pages without using the actual sheet as a reference? In other words, can I have two sheets linked by Identifying the same exact names one on each sheet? ...

Excel newbie needs help from math wiz (poker related)
I want to create a Excel workbook that will help in specific poker situations. Short version: I want to be able to calculate how often my opponent will need to fold for an all-in raise to show a positive expectation. Explanation: In poker you can win a hand by having the best hand at the end OR getting your opponent to fold. A common situation comes up where you have a "drawing hand" and face a bet by your opponent. In this situation you know you are currently behind in the hand, but have a chance to win if you catch some of your "outs" (cards that will give you th...

Macro help needed........
How do I sort a particular column in ascending order and change the pag setup to landscape and margins to 0.25 using a macro code ? does anyone have a macro code for this ????? -- Message posted from http://www.ExcelForum.com Hi you have already received some answers in your previous threads please don't multipost! -- Regards Frank Kabel Frankfurt, Germany > How do I sort a particular column in ascending order and change the > page setup to landscape and margins to 0.25 using a macro code ? > > does anyone have a macro code for this ?????? > > > --- > Me...

Excel 97 / 2000 Viewer
Is there a problem with installing this product when I already have the Excel V. 5.0 on my computer? No -- Greeting from the Gulf Coast! http://myweb.cableone.net/twodays <jbeiting@cinci.rr.com> wrote in message news:059c01c3c647$2c87c9a0$a001280a@phx.gbl... > > Is there a problem with installing this product when I > already have the Excel V. 5.0 on my computer? ...

Need to test a mobo
I had a power surge about 3 weeks ago - lost a drive, now making ticking noises. I had another two drive that seem to work sporadically now. So, I thought it might have been my power supply. Bought a tester and found out that all seems well. Next, I bought a new hard drive and found that it was also acting up - making noises like whirring up and down (like the other drives I thought were dead). So I am starting to wonder if it is my mobo - but how can I test this out? I am using a dual boot - Win XP and Win 7 - both drives work and don't work. Up and down. Right now my Win7 ...

Help needed
is there anyway you can see what links to other workbooks are associated with the workbook you have open. The problem i am having is when i open the workbook in question a message appears and states "The workbook you opened contains automatic links to information in another workbook. do you want to update this workbook with changes made to the other workbook" Yes....... No. if i click No the workbook opens, however if i click Yes the workbook just hangs and i have to go into task manager to shut down the system. I can only assume that there is a problem with one of the links....

Help with formula 12-17-09
Let's say I have in cell A1 a combo box with options: 1. Expense 2. Refund 3. Tax In cell B1 I will type a number In cell C3 I want a formula like this: If in cell A1 I have selected 1. Expense than calculate B1*25 If in cell A1 I have selected 2. Refund than calculate B1*50 If in cell A1 I have selected 3. Tax than calculate B1*150 How can I apply the combo box to entire column, like if I go to row 2 to find in B1 the combo box from A1 and in C2 the formula from C1 Thanks for the help In c1: =IF(A1="Expense",B1*25,IF(A1="Refund",B1*50,B1*150)) Micky ...

select a specific ActiveCell by VBA
In any cell in column "F", a user can select a code number from a drop down list. These numbers go up to over 100, so, if the user isn't sure of which number to select, cell F6 can be rightclicked and VBA will take the user to a different sheet where all the code numbers (and their associated meanings) are listed. A command button on that sheet will take the user back to the ActiveCell on the first sheet. Even if the user was working in cell F2000, the active cell is now always F6 To get around this, how can I set the active row to the bottom most row with data i...

2 sumif functions in one formula
Is it possible to have 2 sumif functions in one formula and return the same results. If so, how would the formula be written? Thanks. Todd If you are to return the same results why do you need 2 formulas? It would be good to give specifics with examples. -- Don Guillett SalesAid Software donaldb@281.com "Todd" <anonymous@discussions.microsoft.com> wrote in message news:04d201c3b391$f9f5ef20$a301280a@phx.gbl... > Is it possible to have 2 sumif functions in one formula > and return the same results. If so, how would the formula > be written? Thanks. > > T...

Need help on this....thanks
I have an Excel worksheet which stored a survey outcome of over 1200 members. There are over 30 questions in the survey and the first column captured the member ID. The problem is 3 of the survey questions that allow multiple answers, instead the answer for those three questions are captured in seperate column, the answers are stored in a single column and it makes it very difficult to analysis those result. As a result I created addittional columns depending on the total number of the answers available for that question and assign the result manually to that column. It is very time consuming ...

Excel 2003 coding issue
I have a button, when pressed it will ask the user to select the email address from sheet 2, the problem i'm having is if I hide columns A, B and C it comes up with a debug error but if the columns stay visable it works? VB highlights the following: Set EmailAddr = Application.InputBox("Select Email Addresses, Click on the Email Worksheet" & vbCrLf & _ "Hold down Contrl Key to select multiple addresses", Type:=8) Please help. ...

I need Help
I have a random popup that i cant stop,when it does come up it seems to know what i was looking at,like when i was looking for registry cleaner it popped up and showed me one,any help would be great. On Jan 22, 6:57=A0am, Larry <La...@discussions.microsoft.com> wrote: > I have a random popup that i cant stop,when it does come up it seems to k= now > what i was looking at,like when i was looking for registry cleaner it pop= ped > up and showed me one,any help would be great. To eliminate questions and guessing, please provide additional information about your sys...

need help badly
How do you print ole objects.. Thanks lachanda -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200710/1 On Wed, 03 Oct 2007 18:13:40 GMT, "misschanda via AccessMonster.com" <u36612@uwe> wrote: >How do you print ole objects.. >Thanks >lachanda What *kind* of OLE objects? Many of them are binary blobs (such as programs) which are inherently not printable. More details please! John W. Vinson [MVP] ...

VBA code to run macro in certain file based on name of file in cel
I am trying to come up with code that will run a macro in a workbook where the path and name of the workbook are in a cell reference. I have tried the following with no luck. The path to the file is located in cell F36 of worksheet, "Customize" and the name of the file is located in cell F42. The name of the macro is "ClearTotalSavings". Any help from one of you gurus would sure be appreciated. Application.Run "'" & Workbooks(Sheets("Customize").Range("F36").Value) & "\" & Sheets("Customize").R...

Stuck in review and need to be in design.
I am using Visio 2007. I need to complete the diagram that I have been working on and I hit the review key by mistake. How do I get back to the design screen? On Wed, 4 Nov 2009 16:14:01 -0800, cameron <cameron@discussions.microsoft.com> wrote: >I am using Visio 2007. I need to complete the diagram that I have been >working on and I hit the review key by mistake. How do I get back to the >design screen? menu Tools -> Track Markup and then close the Review window. -- Regards, Paul Herber, Sandrila Ltd. DFD/SSADM for Visio http://www.visio-dfd.sa...

How do I Create backup of excel file in other folder
Hi, I need the excel backup files to be saved in other folder. I'v choosen "Always create backup" in the save option, but I have traffic in my working folder, so I need the backup files to be in other folder. Using VBA< you can use the SaveCopyAs method and specify the target. -- HTH Bob Phillips "khalid" <khalid@discussions.microsoft.com> wrote in message news:A442EDF2-66D9-4F8E-A36D-13CFE12A22F3@microsoft.com... > Hi, I need the excel backup files to be saved in other folder. > I'v choosen "Always create backup" in the save option, ...

Excel work sheets
Hi, I need a formula that will automatically pull information from one worksheet to another. I need to be able to seperate all of the plans, procedures ect from the main work sheet to there own. I have no idea how to do this, so any help with be appreciated. Heather You don't provide enough information for anyone to help you. Pulling information from one worksheet to another is fairly simple. But what information? Where is it? Where do you want it to go? You say "to their own". How is the destination identified in the source sheet? You have t...

sumif formula required
Hello I have only basic knowledge of excel and need a formula to extrac information. A B C Client Process Sqm CEK Fibre 100 RDF Gloss 200 ERF Emul 150 CEK Fibre 100 What formula should I use to extract all CEK clients who purchase th fibre process giving total sqm. I would be extremely grateful to anyone who...

Need Help Despertly!
I am in a desperate situation. I had to reformat my hard drive. Prior to do this, I copied my entire User Profile to another drive. I can now access my User Profile information from Windows Explorer. Now that I installed Microsoft Outlook, I do not see any of my Contacts. I need to restore my Contacts to the new Outlook installation. Again, I did save my entire "User Profile" from my previous installation of Windows 2000 Professional. I just do not know how to access my Contact information from Outlook that included addresses and phone numbers and such. Any help would be greatly appr...