Home > other >  How to sum a row based on a criteria
How to sum a row based on a criteria

Time:07-28

enter image description here

I am looking to sum A:G (Mon-Sun) only if the Status is Active.(Col I). I want this inserted to Column H(Total)

CodePudding user response:

Try SUMPRODUCT()-

=SUMPRODUCT((A2:G50000)*(H2:H50000="Active"))

enter image description here

CodePudding user response:

enter image description here

Private Sub CommandButton1_Click()
For y = 7 To 8
    Range("H" & y).Clear
    If Range("I" & y) = "ACTIVE" Then
    Range("H" & y).Clear
        For i = 1 To 7
            Range("H" & y) = Cells(y, 8)   Cells(y, i)
            Next i
    
    End If
  Next y
End Sub

U can do with button i think its will be better

  • Related