Is it possible to make a macro that counts the number of cells with a specific value and background color? Ideally you should be able to fill in criteria in a formula on the sheet (color criteria as color index).
Is it possible to make a macro that counts the number of cells with a specific value and background color? Ideally you should be able to fill in criteria in a formula on the sheet (color criteria as color index).
Yes. The following sub counts the number of cells in range A1:A20 for values matching the value in cell B1 and the color of cell B2.
Please Login or Register to view this content.
Should I write =ColorFunction in the cell where I want the result, I get #NAME?.
See the attached file. Click the Count button (which runs the sub called CountCells). It counts the number of cells in the range A1:A20 which match the value of cell B1 and the colour of cell B2.
You have not attached any file.
Thank you very much, it worked.
Last edited by jope1993; 08-03-2012 at 12:35 PM.
@ jope1993
Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
Thanks.
Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
@ mojo249
Excuse me, it was me that was not clear, but I need a macro that only counts cells that both the value and the reverse primer corresponds to the specified value and the reverse primer.
For example, if the specified value is 3 and the reverse primer is blue, then you should only count cells that have both the 3 and the background color blue. It should not count on a cell such as reverse primer would be green but still the value is 3.
Hope you can understand what I mean.
Jope
The best way of learning is having a go. I've shown you how to count based on value and colour. Try modifying it to suit your needs.
If you get stuck post back.
Dion
Sorry that I have not responded.
I know that the best way to learn is by trying yourself. And this I have done, but failed and the reason I wrote on the forum.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks