LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default OFFSET in Excel VBA Function

I am attempting to move an Excel formula from a worksheet and place it
in an Excel VBA function.

Naively, I thought that I could simply take the worksheet equation,
pass it variables, and add "Application." to all worksheet
function. I took the "Application." out of the VBA function to make it
easier to read.

Unfortunately this does not work for the OFFSET function, but I have
not been able to figure out just why.

Excel Worksheet Function:
=SUMPRODUCT(OFFSET(CI9,-MIN(CF9-Year_First,Fac_Depr),0,MIN(CF9-Year_First+1,Fac_Depr+1),1),
OFFSET(FirstInvFacTangDrillDepr,-MIN(CF9-Year_First,Fac_Depr),0,MIN(CF9-Year_First+1,Fac_Depr+1),1))

CF9,CI9 and named cells are single cells as opposed to multiple ones
such as in a range

Attempted Excel VBA Function:
Function FirstYearDepreciation(Current_Year, Year_First, Fac_Depr,
FirstInvFacTangDrillDepr, Eligible_Depr)
Dim Current_Year As Double
Dim Year_First As Double
Dim Fac_Depr As Integer
Dim FirstInvFacTangDrillDepr As Double
Dim Eligible_Depr As Variant

FirstYearDepreciation = SumProduct( _
Offset(Eligible_Depr, -Min(Current_Year - Year_First, Fac_Depr), 0,
Min(Current_Year - Year_First + 1, Fac_Depr + 1), 1), _
Offset(FirstInvFacTangDrillDepr, -Min(Current_Year - Year_First,
Fac_Depr), 0, Min(Current_Year - Year_First + 1, Fac_Depr + 1), 1))

End Function


Can anyone shed some light on this?

Thanks in advance.

Floyd

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
large function result as reference for offset function Z Excel Discussion (Misc queries) 1 May 5th 09 12:55 AM
XL2002 - OFFSET function and LARGE function Trevor Williams Excel Worksheet Functions 3 March 3rd 08 01:40 PM
Offset function in Excel 2003 CLarshtnt Excel Worksheet Functions 7 November 27th 07 02:29 PM
Offset function with nested match function not finding host ss. MKunert Excel Worksheet Functions 1 March 21st 06 10:46 PM
help with offset function Mexage Excel Worksheet Functions 0 May 24th 05 05:18 PM


All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"