Using CountIf in VBA/Macros

dougd

New Member
Joined
Dec 2, 2005
Messages
1
Hi all

I am a new user to Excel and am struggling with a spreadsheet that takes 8 variables, the interaction of which will yield a specific output depending on a given rule-set.
For example: depending on whether or not one figure in a group of three is less than, say, a 2 and that the remaining 5 numbers remain constant an x is yielded. The number of permutations here quickly mount up to something in the region of 4096. I have attempted to write a program to deal with this and decided I'd try it in a macro. I find myself in a quandry however: in the formula bar I can use CountIf to identify how many numbers fall below a set level in either of the two groups of numbers (3 in the first group and 5 in the second), which then satisfies the AND part of the If statements to yield a given outcome. However, because of the complexity of the number of variables, and because of the limit on nested Ifs, I decided to use a macro ... except I can't find the equivalent for CountIf in macro/VBA world.
After all of this then, my question is: how do I accomplish the functionality of the CountIf statement in the macro/VBA environment?

Thanks for any assistance rendered.
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Watch MrExcel Video

Forum statistics

Threads
1,118,910
Messages
5,574,994
Members
412,633
Latest member
simon_elvin
Top