count the number of times a number appears in a specific range
I was having some trouble with this macro hoping I could get some assistance!
So, starting with cell D254 look for the following values: 110, 130, 150, and 160.
in the cells D254, F254, H254, J254, and L254. then go to D255 and do the same things for F, H, J, and L255.
Continue this count untill Line 1454 and put the totals for the four numbers at the end of the document (preferably coluumns a, b, c and d
One caveat is to not add an instance to the total if the previous checked cell has the same value.
(so if F255 is 110 and D255 is 110, don't count F255. or if D255 is 110 and L254 is 110 dont count D255)
This would be greatly appreciated.
Last edited by myjebay1; 05-17-2013 at 03:20 PM.
Re: count the number of times a number appears in a specific range
Not sure VBA is needed...though this formula approach can be turned into a macro, certainly, just by recording these steps one time:
1) Turn on macro recorder
2) Enter these values in N253:Q253
3) Put this formula in N254, then copy it down and across through Q1454:
=IF(OR($D254=N$253, $F254=N$253, $H254=N$253, J254=$N$253, L$254=N253),1,0)
4) Repeat these values in N1456:Q1456
5) Put this formula in N1457, then copy to the right:
6) To make this result permanent, highlight N1457:Q1457, COPY, then Paste Special > Values.
7) Now you can delete the data above in N253:Q1454
8) Turn off the macro recorder. That macro should be reusable now.
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use the
icon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us?
- Ray Kroc
?Actually, I *am* a rocket scientist.?
- JB (little ones count!)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Search Engine Friendly URLs by vBSEO 3.6.0 RC 1