Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Editing in formula

Hi: Can any one please tell me how to i modify the sumif3D code so that
it will accept the file name too. I try it to pass 4th argument in it
but it shows no error and no value. I copied this formula from
http://www.j-walk.com/ss/excel/eee/eee003.txt

=SumIf3D("SALE0106:SALE1206!A2:A9999",A2,J$2:J$999 9,"blabla.xls")

Function SumIf3D(Range3D As String, Criteria As String, _
Optional Sum_Range As Variant) As Variant

Dim sTestRange As String
Dim sSumRange As String
Dim Sheet1 As Integer
Dim Sheet2 As Integer
Dim n As Integer
Dim Sum As Double

' Application.Volatile

If Parse3DRange(Application.Caller.Parent.Parent.Name , _
Range3D, Sheet1, Sheet2, sTestRange) = False Then
SumIf3D = CVErr(xlErrRef)
End If

If IsMissing(Sum_Range) Then
sSumRange = sTestRange
Else
sSumRange = Sum_Range.Address
End If

Sum = 0
For n = Sheet1 To Sheet2
With Worksheets(n)
Sum = Sum + Application.WorksheetFunction.SumIf(.Range _
(sTestRange), Criteria, .Range(sSumRange))
End With
Next n
SumIf3D = Sum
End Function

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Editing in formula

You can't pass a 4th argument to a function that expects only 3.
Joerg

"Anna" wrote in message
ups.com...
Hi: Can any one please tell me how to i modify the sumif3D code so that
it will accept the file name too. I try it to pass 4th argument in it
but it shows no error and no value. I copied this formula from
http://www.j-walk.com/ss/excel/eee/eee003.txt

=SumIf3D("SALE0106:SALE1206!A2:A9999",A2,J$2:J$999 9,"blabla.xls")

Function SumIf3D(Range3D As String, Criteria As String, _
Optional Sum_Range As Variant) As Variant

Dim sTestRange As String
Dim sSumRange As String
Dim Sheet1 As Integer
Dim Sheet2 As Integer
Dim n As Integer
Dim Sum As Double

' Application.Volatile

If Parse3DRange(Application.Caller.Parent.Parent.Name , _
Range3D, Sheet1, Sheet2, sTestRange) = False Then
SumIf3D = CVErr(xlErrRef)
End If

If IsMissing(Sum_Range) Then
sSumRange = sTestRange
Else
sSumRange = Sum_Range.Address
End If

Sum = 0
For n = Sheet1 To Sheet2
With Worksheets(n)
Sum = Sum + Application.WorksheetFunction.SumIf(.Range _
(sTestRange), Criteria, .Range(sSumRange))
End With
Next n
SumIf3D = Sum
End Function

Thanks.



Reply
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
Help with a formula I am editing saltnsnails Excel Discussion (Misc queries) 5 January 10th 09 02:35 AM
Formula editing adimar Excel Worksheet Functions 2 February 6th 08 10:49 PM
Editing a formula mark v. Excel Discussion (Misc queries) 0 September 27th 07 08:23 PM
Help with editing a formula Hell-fire[_3_] Excel Worksheet Functions 7 July 4th 07 12:56 AM
Formula Editing Joe Gieder Excel Worksheet Functions 1 June 26th 06 05:04 PM


All times are GMT +1. The time now is 06:24 AM.

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

About Us

"It's about Microsoft Excel"