Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2014, 06:10 AM
persist persist is offline Define a spreadsheet range using two named variables Windows 7 Define a spreadsheet range using two named variables Office 2007
Novice
Define a spreadsheet range using two named variables
 
Join Date: Mar 2010
Posts: 8
persist is on a distinguished road
Default Define a spreadsheet range using two named variables

I am trying to build a quick and dirty way of calculating the IRR for a series of share investments.

Data
A B C
1 Share1 -1000 1/1/2012 buy
2 Share1 50 1/6/2012 dividend
3 Share1 900 1/5/2014 current value
4 Share2 -2000 4/2/2012 buy
5 Share2 60 9/9/2012 div
6 Share2 70 1/1/1013 div
7 Share2 2500 1/5/2014 current value
8 Share3 …

I copy this table of data from a query in an access database
I paste it into excel
I want the IRR for investment in each share
I do not know how many cash movements will be involved with any share



This works
IRR = XIRR(B4:B7, C4:C7, 8)
I can manually retype the range for each share1, then share2, then ...


I would like to save some of this typing

I tried the following - but it gave an error

RowFirst = 4
RowLast = 7
IRR = XIRR(B[RowFirst]:B[RowLast], C[RowFirst]:C[RowLast], 8)

Is there an easy way for me to define the cashflow range and the date range for each company one after the other

Could I use visual basic code?
From within VB there seems to only be the IRR function which is for periodic cash movements
From the spreadsheet there is XIRR that handles a series of dates and cash movements

Using ms Excel 2007
Reply With Quote
  #2  
Old 05-13-2014, 10:27 AM
BobBridges's Avatar
BobBridges BobBridges is offline Define a spreadsheet range using two named variables Windows 7 64bit Define a spreadsheet range using two named variables Office 2010 32bit
Expert
 
Join Date: May 2013
Location: USA
Posts: 700
BobBridges has a spectacular aura aboutBobBridges has a spectacular aura about
Default

You can use VBA, and it may work better if you do, but it's not absolutely necessary. In fact, after a little playing around I managed to make the formula solution work with just one helping column, which surprised me; I thought it would take more. See the attached.

For the cost of just one helping column I'd probably stick with that. But you can write your own worksheet function, if you'd prefer. Sometimes they're fun, but they do take longer to run so if you have more than a few hundred of these, you may decide to stick with the formula.
Attached Files
File Type: xlsx x.xlsx (9.8 KB, 9 views)
Reply With Quote
  #3  
Old 05-13-2014, 10:56 PM
persist persist is offline Define a spreadsheet range using two named variables Windows 7 Define a spreadsheet range using two named variables Office 2007
Novice
Define a spreadsheet range using two named variables
 
Join Date: Mar 2010
Posts: 8
persist is on a distinguished road
Default

Thanks. That is brilliant.
I now feed in the "Order" of the cash movements within each investment: 1, 2, 3 etc
This generates the offsets that you need for your formula = 1 - Order = 0, -1, -2, etc
For some unknown reason this also fixed a problem I was having with XIRR
XIRR had been refusing to give negative internal rates of return. Now it is fine.
Thanks Problem solved.
Reply With Quote
Reply

Tags
excel 2007, names, range



Similar Threads
Thread Thread Starter Forum Replies Last Post
Define a spreadsheet range using two named variables How to define restrictions to resource combination andrebmsilva Project 6 11-10-2013 03:02 PM
Referencing a named (calculated) range on a remote spreadsheet TishyMouse Excel 1 04-25-2012 08:45 AM
Define a spreadsheet range using two named variables Excel - move with tab through named range mjlaw Excel 4 03-26-2012 10:40 AM
Define a spreadsheet range using two named variables Named range drop-down jgelpi16 Excel 1 04-08-2011 03:08 PM
Define a spreadsheet range using two named variables Is there a way to Define a common Table Format as Object? blackduck603 Word Tables 1 02-20-2009 03:25 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft