YEARFRAC unavailable???

A

Andrius B.

Hi all.
I could not solve the problem:
I want to use YearFrac function, but no results. I Have tried all examples
found in Excel help and on Internet, but continue to get errors. It seems
that this function is unavailable at all, regardless I add "Analysis Toll"
addin to my project. What's the problem? How to enable this function? Should
I install install VBA or smth?

I have OfficeXP (SP3) installed with all components.
My OS is WindowsXP with SP3. Also I have on my PC
VisualBasic 2005 Express and Microsoft .NET 2.0; could there be any conflict
with these?

I have no ideas...

Please give an advice.

Thanks in advance.
 
J

James Silverton

Andrius wrote on Wed, 22 Mar 2006 21:25:11 +0200:

AB> I have OfficeXP (SP3) installed with all components.
AB> My OS is WindowsXP with SP3. Also I have on my PC
AB> VisualBasic 2005 Express and Microsoft .NET 2.0; could
AB> there be any conflict with these?
I could not solve the problem:
I want to use YearFrac function, but no results. I Have tried
all examples
found in Excel help and on Internet, but continue to get errors.
It seems


AB> I have no ideas...

AB> Please give an advice.

I just tried YEARFRAC with Excel 2002 and it seemed to work
well. My test example was
=YEARFRAC(DATE(2006,1,1),DATE(2006,6,1),0), with a result:
0.416667. I used the Date function as suggested in HELP and I do
have the Analysis Pack installed.

James Silverton.
 
G

George Nicholson

http://www.cpearson.com/excel/ATP.htm

1) In Excel's User Interface: under Tools>Add-Ins, make sure "Analysis
Toolpak - VBA" is checked
2) In the VB Editor: under Tools>References, make sure "atpvbaen.xls" is
checked.

You should now be able to use the toolpak functions within VBA just like a
VBA functions.
? YearFrac(#1/1/2006#, #6/30/2006#)
The above, typed in the VBE Immediate window, returns 0.4972

HTH,
 
Top