View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sally Sally is offline
external usenet poster
 
Posts: 36
Default Sumproduct and Beyond

The code works for H but is counting not totaling. and how do I copy it
across the other 19 cells

Thanks!


"Bob Phillips" wrote:

This does it for H,

Dim iLastRow As Long

iLastRow = Range("H1").End(xlDown).Row
If Range("H1").Value < "" Then
Cells(iLastRow + 1, "H").Formula = _
"=SUMPRODUCT(--(F1:F" & iLastRow & "=""F"")," & _
"--(G1:G" & iLastRow & "=""o""))"
End If


but a couple of questions.

What if H6 is the first blank in H, but F10 and G10 have values?

If you want to extend to say I, J, K the data will be overlappiong. What are
the other columns?

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Sally" wrote in message
...
Hello
I am relatively new to VB and need help. I am not quite sure how to
accomplish this.... I need routine that will find the first blank cell in
Col H and insert a sumproduct type formula. That will sum all of the

cells
in Col H where the value in the same row in col G is equal to "o" and the
value in col F contains "F". I also need to replicate this over 20 columns

in
the same row. I am still trying to learn how to use sumproduct so if the
formula use would be different, what would this be?
Thanks