VBA'd if needed.
Cheers
Dave
Looking for help with a VBA routine to read two lists and report the difference in each. A file is attached with two sample lists and and the results I am trying to produce with the VBA. The actual lists both have several hundred values so an array solution may be faster but I am open to any workable option.
Thanks,
Jerry
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks Dave,
I understand your solution and how it would work with formulas on a worksheet but I am not sure I can get to the end result with my limited VBA knowledge. I use some of the same books that Barry uses for VBA. :)
I am building the lists on the fly... comparing a list of people's names I read from and external database and a list of worksheet names in a master worksheet. Checking to see if I have a worksheet for each person and then checking if I have an extra worksheet for a person that has been removed from the database. I have snippets of VBA to extract the two lists but not sure how to compare them.
Can you provide some basic VBA with the CountIF that I can try to work with?
Thanks,
Jerry
No worries
In brief the code
- defines the size of the ranges for columns A&B, inderts two new columns in C & D
- adds in the COUNTIF formulas (the rng1.Offset(0, 2).FormulaR1C1 = "=IF(COUNTIF(" & rng1.Address(, , xlR1C1) & ",RC[-1])=0,RC[-1],"""")" part).
- coverts the formulas to values, to provide either text for differences, or to convert the "" into a blank cell (this is the shortcut trick)
- SpecialCells(xlblanks) then kills all the blank cells to remove the spaces in the list
Cheers
Dave
Dave,
If you are still online can you help me with some additional syntax on your code.
It turns out that the row count on both the rng1 and rng2 need to be the set to the largest value of the number of rows in column A & B. The formulas do not copy down far enough on the longer row and the CountIF is missing some values. There are 97 rows in A and 103 in B. So... where we are writing the formula to Column C, it stops at row 97 and is missing the remaining 6 comparisons. Need something like the MAX function would provide.
I have tried a couple of times but I am not having much luck. I am sure it is simple and but I am just not getting it correct yet. I guess that is part of learning. :)
Thanks,
Jerry
Thanks Dave - just saw your last post.
It was after 3:00 AM when I got things working and I headed straight to bed after that. Those two list were just a nagging little problem that kept getting worse quarter by quarter as the number of entries grew. I am sure the young lady that has to deal with comparing the two manually every month will be very happy you were around last night. I'll make sure she knows who the genius behind the scenes was. :)
Enjoy the rest of your weekend!
Business Accounts
Answer for Membership
by: brettdjPosted on 2009-07-03 at 20:53:07ID: 24775658
Jerry,
B2)=0,B2," ")
A2)=0,A2," ")
One quick way is to use a COUNTIF on both ranges
for the A -list differences
In C2 put
=IF(COUNTIF($A$2:$A$27,
and copy down
for the B -list differences
In D2 put
=IF(COUNTIF($B$2:$B$27,
and copy down
This can be automated with VBA to add these formulas then remove the blank cells with filtering if you wish
Cheers
Dave
file