PDA

View Full Version : Sumif , between to sheets



Nader
01-13-2008, 08:33 AM
I tried to insert the Sumif function in sheet3's column2 to sum the cells in sheet2's column2, comparing with the match between the cells in sheet2's,column1 with sheet3's column1.
it's mean if data in sheet's2 column1 george,john,jeny,george,jeny - column2 ,2,4,5,4,8
and the data in sheet3's column1 has the same data .Sumif function will show the result (of sum the number in sheet2's column2) in the sheet3's column2 .

Dim cell As Range, cel As Range
Set myRange3 = Worksheets(2).Range("A1:A100")
Set myRange4 = Worksheets(2).Range("b1:b100")
For Each cell In myRange3
For Each cel In Sheets(3).Range("a1:a100")
If cel.Value = cell.Value And cell.Value <> "" Then
cel.Offset(0, 1).Value = "=SUMIF(A1:a100," & cell.Address & ",B1:b100)"
End If
Next
Next

The Sumif doesn't work well .

Bob Phillips
01-13-2008, 08:49 AM
I am not getting a picture of wat you want to do, so could you post a workbook and some example results?

Nader
01-13-2008, 11:12 AM
If I make any change in sheet2's column 2 it will effect to the sheet3's column2

Bob Phillips
01-13-2008, 11:15 AM
=SUMIF(Sheet2!B:B,B6,Sheet2!A:A)

Nader
01-13-2008, 04:13 PM
It didn't success with me . here is the code and data in xls file.

Shazam
01-13-2008, 05:56 PM
=SUMIF(Sheet2!A:A,A1,Sheet2!B:B)

Nader
01-13-2008, 10:25 PM
It doesn't success too.

Bob Phillips
01-14-2008, 12:41 PM
=SUMIF(Sheet2!A:A,Sheet3!A1,Sheet2!B:B)

Nader
01-14-2008, 04:55 PM
Oky thank you I'll try it