vb.net - Countif with next cell not empty -
i need count how many times string appear within range when next cell not empty.
a 1 b 5 d 4 g 1 b 4 b 8 d so want a->1, b->3, d->1, g->1
how can that?
if you're looking cell formula, should need:
=countifs(a1:a8,"a",b1:b8,"<>") where a1:a8 letter column, , b1:b8 number column.
*note countifs() (with s), not countif() (no s).
for completeness, work, can more convoluted may want work with:
=sumproduct((a1:a8="a")*(len(b1:b8)>0)) if you're looking vb(a) solution, should work:
for = 1 8 'replace mysheet , cellcount proper variables use if mysheet.range("a" & i).value2 = "a" , len(mysheet.range("b" & i)) > 0 cellcount = cellcount + 1 end if next
Comments
Post a Comment