• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Search for occurence of value in a given range of a filtered data (visible rows)


Hello There,

I would like to have a Function in VBA which can return the occurence of a given value for the below situation:
1. Data is filtered
2. Search for a value in a given range and count it's occurence (in the filtered area, visible rows only)

Parameters for the Function would be:
1. Range
2. Search value

I have attached a sample workbook for your reference.

Look forward to hearing from you.




Well-Known Member
In the attached:
1. Formula in cell O15
2. Click the button for the result to show in cell M15
3. A macro called blah which when run with that sheet the active sheet will show the result in a message box.

A user-defined function is difficult because xlcellTypeVisible doesn't work in a user defined function macro called from a sheet.