Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Clinton, Here is User Defined Function in VBA. It can be used just like regular Excel Formula. It assumes that the index K is the number of entries that will b successively summed according to your formula. The cells don't need t be contiguous, but do need to be in the same row. Add a VBA Module to your project and copy this code into it. USING THE UDF =Sum3Up(<cell Arg A, <cell Arg B, <cell Arg C, <cell Arg D, <cel Arg E, Index_K) Code ------------------- Public Function Sum3Up(ByRef ArgA As Range, ByRef ArgB As Range, ByRef ArgC As Range, ByRef ArgD As Range, ByRef ArgE As Range, ByVal Index_K As Long) As Double Application.Volatile Dim I As Long Dim Sigma As Double 'Summation Formula: Sigma = ( A^( k+1 ) ) * ( B / C ) * ( 1 - ( D / E ) ) For I = 1 To Index_K 'Avoid division by zero error If ArgC.Cells(I, 1).Value < 0 And ArgE.Cells(I, 1).Value < 0 Then Sigma = Sigma + (ArgA.Cells(I, 1).Value ^ (I + 1) _ * (ArgB.Cells(I, 1).Value / ArgC.Cells(I, 1).Value) _ * (1 - (ArgD.Cells(I, 1).Value / ArgE.Cells(I, 1).Value))) End If Next I Sum3Up = Sigma End Function ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=48660 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Vlookup multiple lookup values and sumation | Excel Worksheet Functions | |||
shaded cell sumation | Excel Discussion (Misc queries) | |||
Error handling VLOOKUP. #N/A - can it be 0 to allow sumation. | Excel Worksheet Functions | |||
Sumation | Excel Discussion (Misc queries) | |||
How am i able to populate a sumation for multiple sheets | Excel Worksheet Functions |