Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Closed Thread
  #1  
Old 07-03-2009, 02:40 AM
pranavsawjiany pranavsawjiany is offline
Registered User
 
Join Date: 03 Jul 2009
Location: NYC, USA
MS Office Version:Excel 2003 and 2007
Posts: 2
pranavsawjiany is becoming part of the community
Running XIRR in Excel via a User Defined Function

Please Register to Remove these Ads

I created a user defined function called FilterXIRRNew in Excel 2003 that takes in a bunch of arrays, does some processing and filtering and finally calls the built in XIRR function in excel to calculate the IRR for a series of cash flows. The function worked fine in Excel 2003

Code:
Public Function FilterXIRRNew(FilteredCF, FilteredDates, FilteredVal, valDate, InvestMultiple)
    
' Bunch of code here followed by calling the XIRR function

            FilterXIRRNew = Application.Run("xIRR", TrueCF, TrueDates, GuessIRR)


End Function
This function worked fine in Excel 2003. Now that I have opened the file in 2007, FilterXIRRNew is no longer working properly. The code works fine upto the line where it calls the in built XIRR function. I have enabled Macros in Excel 2007 and also installed the Add-In that contains the built-in XIRR function. The XIRR function works properly byitself. I am only having trouble with my user defined FilterXIRR function.

Any help would be very much appreciated.
Thanks.
  #2  
Old 07-03-2009, 03:00 AM
shg's Avatar
shg shg is offline
Forum Guru
 
Join Date: 21 Jun 2007
Location: The Great State of Texas
MS Office Version:2003, 2007
Posts: 18,306
shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay shg makes giving solutions look like childsplay
Re: Running XIRR in Excel via a User Defined Function

Can you use the XIRR function successfully as a UDF in the 2007 add-in?

Try
Code:
FilterXIRRNew = myAddIn!xIRR(TrueCF, TrueDates, GuessIRR)
Please read the forum rules before posting again.
__________________
Entia non sunt multiplicanda sine necessitate.
  #3  
Old 01-21-2010, 02:43 AM
pinnacle pinnacle is offline
Registered User
 
Join Date: 21 Jan 2010
Location: India, Mumbai
MS Office Version:Excel 2003
Posts: 1
pinnacle is becoming part of the community
Cool Re: how to I use XIRR to calculate returns for selected stocks in my portfolio

Using XIRR for the a series of all stocks is pretty straightforward when you have recorded all transactions in terms of cashflows with their respective dates.

But if I want to calculate returns for exixting stocks within that portfolio, then I need to match and pass arguments to the xirr function only for those specific assets.

Something like SUMIF, but unfortunately there is no XIRR if.

How do I get this done. Its been driving me nuts. I guess there is a way to write a macro or VBA function to pass arguments of that specific stock (and sorted in the ascending order of dates as XIRR needs) to the XIRR function.

But I dont know much of macros or VBA to do this.!!!...pls help
  #4  
Old 01-21-2010, 03:48 AM
rwgrietveld's Avatar
rwgrietveld rwgrietveld is offline
Forum Guru
 
Join Date: 02 Sep 2008
Location: Netherlands
MS Office Version:XL 2007 / XL 2010
Posts: 1,595
rwgrietveld is very confident of their ability rwgrietveld is very confident of their ability rwgrietveld is very confident of their ability rwgrietveld is very confident of their ability rwgrietveld is very confident of their ability
Re: Running XIRR in Excel via a User Defined Function

pinnacle,

Please start your own new thread! and refer to this one if necessary.
__________________
Looking for great solutions but hate waiting?
Seach this Forum through Google

www.Google.com
(e.g. +multiple +IF site:excelforum.com/excel-general/ )

www.Google.com
(e.g. +fill +combobox site:excelforum.com/excel-programming/ )

Ave,
Ricardo
  #5  
Old 01-21-2010, 03:58 AM
teylyn's Avatar
teylyn teylyn is offline
Forum Moderator
 
Join Date: 28 Oct 2008
Location: German in New Zealand
MS Office Version:2000 - 2010
Posts: 4,470
teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay teylyn makes giving solutions look like childsplay
Re: Running XIRR in Excel via a User Defined Function

Hi pinnacle,

welcome to the forum. As rwgrietveld points out ...

Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.
__________________
teylyn
If you want to say Thank you to a member, click the reputation icon in the title bar of the post you liked
Everyone needs a pat on the back every once in a while!
...How to Cross-post politely...
Things I do with the right side of my brain ...


Closed Thread

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump