Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

function question

  Asked By: Aysel    Date: Mar 19    Category: MS Office    Views: 746
  

i have a simple table...first row is headers (has an autofilter enabled
on all columns)...middle rows are data and last row are totals (sum,
average, etc).

if you use the sum() or average() functions on the totals with the
autofilter on...the totals will not reflect the total of the filtered
data...so i changed the sum() and average() functions with the subtotal
() function...

here's the question...what if instead of sum(), i want to use a sumif()?

the sumif() function i have is supposed to sum only the positive values
found on the column of that table...

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Ava Campbell     Answered On: Mar 19

Here is a function  that seems to do the trick:

Function SumPos(Numbers)
A = Numbers 'convert range to variant array
Nrows = UBound(A, 1)
Ncols = UBound(A, 2)
SumPos = 0
For r = 1 To Nrows
For c = 1 To Ncols
If A(r, c) > 0 Then
SumPos = SumPos + A(r, c)
End If
Next
Next
End Function

 
Didn't find what you were looking for? Find more on function question Or get search suggestion and latest updates.




Tagged: