Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro/VBA code to compare lists & highlight similiar items

How would I take the same code you wrote of:

=IF(SUMPRODUCT(--('Cash Book'!A1:A1000=C1),--('Cash
Book'!B1:B1000=D1))=0,"No Match","Match")

and for everytime the output was no match change the cell color to pink

and if the output of the formula was Match, how would I have the cell turn
light green?

The reason I ask is I am writing a simple macro to compare two lists and I
would like to also color code the output, maybe conditional formating???

Thanks,

John


"Joel" wrote:

I learned VBA coding on my own didn't use books. I think you learn more from
reading postings. If you have a problem you could always try a search on
this website.

"ACCAguy" wrote:

It worked great! What books would you recommend for someone who has average
knowledge of excel to learn more? I currently have Excel Bible and Learn
excel from Mr Excel.
--
ACCAguy


"Joel" wrote:

The formula can be expanded to include what ever conditions you need. Right
now we have

=if(sumproduct(...)=0,"No Match","Match")

what I think you want is this

=if(sumproducr(...)=0,"No Match",if(sumproduct(...)=1,"Match","Duplicates"))

Just replace the 3 dots with Formuas I gave you before.

"ACCAguy" wrote:

Hi@Joel. Thanks for your help the formula worked . I have encountered one
scenario though that causes a problem. If a transaction was duplicated by the
bank ie the same amount twice on the same date this error would not be
isolated by the formula. Is there a way to make the formula only say match
after the first match for each item? Thanks in advance.
--
ACCAguy


"Joel" wrote:

I prefer ion this type of example o f adding an auxilary column indicating
matched and unmatched ites so I can later sort on the matches and unmatched
items. You could always add a condtional format to hight cells based on the
auxilary column.

When you need to match two items the best way is to use a sumproduct.

In the cash book in cell D1 you could put
=IF(SUMPRODUCT(--('Bank Statement'!B1:B1000=A1),--('Bank
Statement'!D1:D1000=C1))=0,"NoMatch","Match")

in the Bank Statement in cell E1
=IF(SUMPRODUCT(--('Cash Book'!A1:A1000=C1),--('Cash
Book'!B1:B1000=D1))=0,"No Match","Match")


Then copy the formulas down the column.

"ACCAguy" wrote:

Hello All:

My problem is that I have 2 worksheets that I need to compare and highlight
the items that are similiar based on 2 criterion. In essence it is a
reconciliation of a bank account so I need to know the items that are
reconciling items plus those that might be on the bank's statement but not in
the cash book or vice versa so I can update the cash book and list the
reconciling items.

Here is a simplified version of the different worksheets:


Cash book

A B C
1 6/9/08 Sale 2000
2 6/15/08 Purch -1000
3 6/4/08 Transf -500

Bank Statement

A B C D
1 001 6/9/08 CAN 2000
2 002 6/15/08 US -1000
3 003 6/4/08 EUR -500
4 004 6/31/08 US 2000

In this example I would like to match columns A & C in the cash book with B
& D in the bank statement and highlight all similiar items thus leaving the
4th row in the bank statement unhighlighted. I would appreciate any
suggestions. Please keep in mind that I am only an average excel user. Thanks
in advance.


--
ACCAguy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare lists and highlight matches srain001 Excel Discussion (Misc queries) 3 March 2nd 07 06:23 PM
Compare lists and highlight matches srain001 Excel Discussion (Misc queries) 2 March 1st 07 02:01 PM
Compare 2 lists and show reconciliing items MikeCM Excel Programming 2 November 8th 06 08:52 AM
How do I compare two lists and choose the items that are in both? laurabailey8 Excel Worksheet Functions 0 January 3rd 06 11:31 PM
Compare 2 columns, and create a list of items that are in both lists ruby2sdy Excel Worksheet Functions 3 October 8th 05 11:04 AM


All times are GMT +1. The time now is 04:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"