excel vba - I am using Sumif function in macro but the result is not getting -
i have used below code answer. m getting result @ required location sum not displayed.
cells(lastrow, 2).offset(3, 1).value = "=sumif(l4:l" & lastrow & "," & "new albertsons inc" & ",j4:j" & lastrow - 1 & ")" could 1 me how sort out.
try one:
cells(lastrow, 2).offset(3, 1).formula = "=sumif(l4:l" & lastrow & "," & """new albertsons inc""" & ",j4:j" & lastrow & ")" some notes:
- i'm using
"""new albertsons inc"""instead"new albertsons inc"(you should escape quotes when constucting excel formulas through vba) sum_range,criteria_rangeshould have same dimmentsion, that's why should usel4:l" & lastrow,j4:j" & lastrow(or& lastrow-1both ranges)- actually, can simplify formula changing
"," & """new albertsons inc"""", ""new albertsons inc"""
Comments
Post a Comment