SUMIFs using Excel VBA

2019-09-16 15:41发布

I am not able to comprehend the concept of SUMIFs in VBA can someone dissect the following code?

If WorksheetFunction.SumIf(ActiveSheet.Columns(3), Range("C" & "6").Value, ActiveSheet.Columns(9)) / WorksheetFunction.CountIf(ActiveSheet.Columns(3), Range("C" & "6").Value) = Range("I" & "6").Value Then 

1条回答
Deceive 欺骗
2楼-- · 2019-09-16 16:29

This part:-

SumIf(ActiveSheet.Columns(3), Range("C" & "6").Value, ActiveSheet.Columns(9))

Basically reads like this:-

Add together all the values in Column I (9th column) where the value in Cell C6 appears in the corresponding row in Column C (3rd column).

SUMIF broken down looks like this:-

SUMIF(Column containing search values, value to search for, column conaintining items to add)

Hope this helps.

查看更多
登录 后发表回答