![]() |
count with a range
I have a range that i have set as myrng
this range is A1:a100, in this range i have either a "n" or a "y" in each cell, how can i use code to count all the y's within this range john |
count with a range
Hello John,
you can make a for each loop und test if the value is y or n. For each vItem in myrng if vItem = "y" then count = count +1 next vItem |
count with a range
is there a way of doing it without looping i have seen a previous post
which used count=countwords(myrng,"y"), but this does not seem to work regards John |
count with a range
or
Sub countem() x = Application.CountIf(Range("a1:a100"), "y") MsgBox x End Sub -- Don Guillett SalesAid Software wrote in message oups.com... I have a range that i have set as myrng this range is A1:a100, in this range i have either a "n" or a "y" in each cell, how can i use code to count all the y's within this range john |
count with a range
count = Application.COUNTIF(myrange,"y")
-- HTH Bob Phillips (remove nothere from email address if mailing direct) wrote in message oups.com... is there a way of doing it without looping i have seen a previous post which used count=countwords(myrng,"y"), but this does not seem to work regards John |
count with a range
thanks that great!!!
John |
count with a range
glad to help
-- Don Guillett SalesAid Software wrote in message oups.com... thanks that great!!! John |
All times are GMT +1. The time now is 07:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com