G2=SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000) 这句话在VBA数组中可行,函数怎么不行了?请问函数怎么写法,或怎么改写?Sub t5()Dim arrarr = Application.SumIf(Range("a2:a10000"),Array("B","C","G","R"),Range("B2:B10000"))Range("G
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/08 06:24:27
![G2=SUMIF(A2:A10000,{](/uploads/image/z/12373284-12-4.jpg?t=G2%3DSUMIF%28A2%3AA10000%2C%7B%22C%22%2C%22G%22%2C%22R%22%2C%22B%22%7D%2CB2%3AB10000%29+%E8%BF%99%E5%8F%A5%E8%AF%9D%E5%9C%A8VBA%E6%95%B0%E7%BB%84%E4%B8%AD%E5%8F%AF%E8%A1%8C%2C%E5%87%BD%E6%95%B0%E6%80%8E%E4%B9%88%E4%B8%8D%E8%A1%8C%E4%BA%86%3F%E8%AF%B7%E9%97%AE%E5%87%BD%E6%95%B0%E6%80%8E%E4%B9%88%E5%86%99%E6%B3%95%2C%E6%88%96%E6%80%8E%E4%B9%88%E6%94%B9%E5%86%99%3FSub+t5%28%29Dim+arrarr+%3D+Application.SumIf%28Range%28%22a2%3Aa10000%22%29%2CArray%28%22B%22%2C%22C%22%2C%22G%22%2C%22R%22%29%2CRange%28%22B2%3AB10000%22%29%29Range%28%22G)
G2=SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000) 这句话在VBA数组中可行,函数怎么不行了?请问函数怎么写法,或怎么改写?Sub t5()Dim arrarr = Application.SumIf(Range("a2:a10000"),Array("B","C","G","R"),Range("B2:B10000"))Range("G
G2=SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000) 这句话在VBA数组中可行,函数怎么不行了?
请问函数怎么写法,或怎么改写?
Sub t5()
Dim arr
arr = Application.SumIf(Range("a2:a10000"),Array("B","C","G","R"),Range("B2:B10000"))
Range("G2").Resize(4,1) = Application.Transpose(arr)
End Sub
G2=SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000) 这句话在VBA数组中可行,函数怎么不行了?请问函数怎么写法,或怎么改写?Sub t5()Dim arrarr = Application.SumIf(Range("a2:a10000"),Array("B","C","G","R"),Range("B2:B10000"))Range("G
G2=SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000)这个虽然不会错,但是有问题啊,它其实相当于G2=SUMIF(A2:A10000,"C",B2:B10000)
所以在宏里面应该是arr = Application.SumIf(Range("a2:a10000"),"C",Range("B2:B10000")).
如果你要统计=C或G或R或B的总和,应该用这个G2=SUM(SUMIF(A2:A10000,{"C","G","R","B"},B2:B10000))
对应宏里面是arr= Application.Sum(Application.SumIf(Range("a2:a10000"),Array("B","C","G","R"),Range("B2:B10000")))