2 Answers

The quickest way would just be to do 2 COUNTIFs:

iVal = Application.WorksheetFunction.CountIf(Range("A:A"), "SAL") + Application.WorksheetFunction.CountIf(Range("A:A"), "PRE")
share|improve this answer
+1, this is your best approach as the CountIf can only accept one parameter.Matt Donnan Jan 4 '12 at 16:15
This works great but in the long run i will be ending up with a lot of variable so trying to find a more efficient method, great intermediate method though!BradStevenson Jan 4 '12 at 16:22
@MattDonnan it is actually possible to feed COUNTIF more than one test, see above.brettdj Jan 4 '12 at 23:36
@brettdj No idea you could use the {} to add more values, it's not in the documentation, really good though. +1Matt Donnan Jan 5 '12 at 10:41
Thanks very much used this method and is working great!BradStevenson Jan 5 '12 at 12:30
show 1 more comment

You could use the VBA equivalent of a standard COUNTIF formula (which can take more than one argument). This can be expanded as required

Standard Formula
=SUM(COUNTIF(A:A, {"SAL","PRE"}))

VBA Equivalent
MsgBox Evaluate("Sum(COUNTIF(A:A,{""PRE"",""SAL""}))")

+ Recent posts