![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:40 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com