Excel VBA, countif function -


before explaining current problematic have little experience excel , vba; therefore struggle here may appear silly geniune.

i have column have range of values going 0 6500. count number of values above 100, 200, 300 ... 6500 , plot given number vs 100. 200. 300 etc.

on excel, use function countif function, act on itteration englobe of values , besides, laborious.

i thinking of simple loop count values each itteration writting result on particular column not sure of how that.

any or tip welcome.

inopiae has great solution - pivot table grouped 100 best way go, since you're asking vba this:

sub createnumbers() 'this populate worksheet column 1 being numbers 1 - 65535     dim topnum&     topnum = 65535     dim ra(topnum, 0)      = lbound(ra) ubound(ra)         ra(i, 0) =     next      activesheet.range(cells(1, 1), cells(topnum + 1, 1)) = ra  end sub  sub countifiteration() 'this output number based on criteria     dim ra     ra = activesheet.usedrange     '& dim long     dim cols&, maxnum&, i&      'defines maximum number of columns plotting counts     maxnum = application.worksheetfunction.max([a:a])     cols = maxnum / 100      redim ra2(1, cols)     = lbound(ra2, 2) ubound(ra2, 2)         ra2(0, i) = clng(i & "00")         j = lbound(ra) ubound(ra)             if ra(j, 1) > ra2(0, i) ra2(1, i) = ra2(1, i) + 1         next j     next      range(cells(1, 3), cells(2, cols + 3)) = ra2  end sub 

Comments