View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default VBA Formula to Count 2 criteria

Just use two COUNTIFs. E.g.,

Dim Total As Long
Total = Application.CountIf(Range("A1:A10"), 1) + _
Application.CountIf(Range("A1:A10"), 5)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Jan" wrote in message
...
Hello All,

I have the following formula that I would like to change to
count 1 and 5 in
the specified range. How do I rewrite the code to accomplish
that task?
Sorry, I don't know VBA code that well to accomplish rewriting
it.

WIP=" & Application.CountIf(OR(Range("u3:u5000"), 5)

TIA
Jan