excel - Generating Pivot table with If case -
i having sheet bw. , sheet man.
i generating pivot table data of "bw".
i generating pivot table row field column "s" . have condition. if column "z" contains "ontime" need count column "t" in pivot table. if "" don't want count of "t".
is possible can in way ?
can help
i have tried below code.
sub autopivot5() dim ws5 worksheet dim pc5 pivotcache dim pt5 pivottable dim ct5 integer set ws5 = sheets("man") set pc5 = activeworkbook.pivotcaches.create(xldatabase, "'bw'!r4c16:r1048576c21") set pt5 = pc5.createpivottable(ws5.range("a3")) pt5.adddatafield pt5.pivotfields("overdue"), "sum of overdue", xlsum pt5 .pivotfields("location") .orientation = xlrowfield .position = 1 .autosort xldescending, "sum of overdue" pt5.tablerange2.offset(0, 1).horizontalalignment = xlcenter end end end sub
Comments
Post a Comment