Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Countif using vba

Is it possible to write a "if command" which performs a countif 0 if a
certain criteria is meet. i.e
r= 2
If cells (r,1) = "Marcus" and cells (r,2) = "Pink" then
countif("A2:AB2"0)
end if

I have tried using the fucntion commande with little success

I need to run this code through 10,000 record on a regural basis, it will
alsways countif the same range, however the row will obviously change.

Many thanks in anticipation

Macus
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Countif using vba


Try:

r= 2
If cells (r,1) = "Marcus" and cells (r,2) = "Pink" then
Msgbox Application.CountIf(A2:AB2,"0")
end i

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=38980

  #3   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Countif using vba

try this:

r = 2
If Cells(r, 1) = "Marcus" And Cells(r, 2) = "Pink" Then
x = Application.CountIf(Range("A" & r & ":AB" & r), "0")
MsgBox x
End If

Regards,
KL



"Mr M Walker" wrote in message
...
Is it possible to write a "if command" which performs a countif 0 if a
certain criteria is meet. i.e
r= 2
If cells (r,1) = "Marcus" and cells (r,2) = "Pink" then
countif("A2:AB2"0)
end if

I have tried using the fucntion commande with little success

I need to run this code through 10,000 record on a regural basis, it will
alsways countif the same range, however the row will obviously change.

Many thanks in anticipation

Macus



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Countif using vba

Dim r

r = 2
If Cells(r, 1) = "Marcus" And Cells(r, 2) = "Pink" Then
MsgBox Application.CountIf(Range("A2:AB2"), "0")
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mr M Walker" wrote in message
...
Is it possible to write a "if command" which performs a countif 0 if a
certain criteria is meet. i.e
r= 2
If cells (r,1) = "Marcus" and cells (r,2) = "Pink" then
countif("A2:AB2"0)
end if

I have tried using the fucntion commande with little success

I need to run this code through 10,000 record on a regural basis, it will
alsways countif the same range, however the row will obviously change.

Many thanks in anticipation

Macus



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
countif JMB Excel Worksheet Functions 0 March 26th 06 11:45 PM
How do I use a countif function according to two other countif fu. Kirsty Excel Worksheet Functions 2 February 20th 06 11:44 AM
edit this =COUNTIF(A1:F16,"*1-2*")+COUNTIF(A1:F16,"*2-1*") sctroy Excel Discussion (Misc queries) 2 September 25th 05 04:13 AM
COUNTIF or not to COUNTIF on a range in another sheet Ellie Excel Worksheet Functions 4 September 15th 05 10:06 PM
COUNTIF in one colum then COUNTIF in another...??? JonnieP Excel Worksheet Functions 3 February 22nd 05 02:55 PM


All times are GMT +1. The time now is 10:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"