我正在尝试对从数组中提取的列中的值求和,并使用两个条件来过滤值。公式返回类型不匹配错误,我不知道为什么。查看监视窗口中的数组不会显示任何明显的错误。有什么建议吗?
Sub TST_SUM_PROD()
Dim VAL As Variant, DATA As Variant, ARR_PARAM As Variant, ARR_DEAL As Variant, ARR_STRAT As Variant
Set RNGE = Worksheets("BOOK").Range("tbl_BOOK").CurrentRegion
Set ARR_PARAM = RNGE.Columns(PARAM_COL)
Set ARR_DEAL = RNGE.Columns(DEAL_COL)
Set ARR_STRAT = RNGE.Columns(STRAT_COL)
SUM_IFS = Application.WorksheetFunction.SumIfs(ARR_PARAM, ARR_DEAL, DEAL_NO)`
VAL = Application.WorksheetFunction.SumProduct(--(ARR_STRAT = "CAL"))
VAL = Application.WorksheetFunction.SumProduct(--(ARR_DEAL = 1))
VAL = Application.WorksheetFunction.SumProduct(ARR_PARAM, --(ARR_STRAT = "CAL"), --(ARR_DEAL = "1"))
End Sub