comparing data if function

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Comparing data with IF function

Comparing data with IF function

resolvedResolved · High Priority · Version 2010

Nasir has attended:
Excel VBA Introduction course
Excel VBA Intermediate course

Comparing data with IF function

Hi All,

I have another question. We get a download of trades daily, some are new trades and some old trades amended today, all gets reported to regulators.

basically I wanted to compare 2 sets of data, data in SHEET1 is the latest and data in SHEET2 are old has multiple versions on each trade. data in each row refers to single trade and can have multiple rows but are in different versions stated in column D

SHEET1 (latest)
SHEET2 (old)

Not sure how to code this but here's what I want to achieve

1. check if trade refs in SHEET1 (in column Z) is in SHEET2 (in column B). if it's not there then keep that row in SHEET1
2. if that reference is in SHEET2 then look for latest version (in numeric)row for that reference which is in column D and then compare following rows that can be in number, letters or mix
3. if there is no difference then delete that row with that trade reference in SHEET1 otherwise keep and highlight cells with difference but only in SHEET1. note we are not amending/deleting anything in SHEET2 that can have multiple rows (versions) for same trade. SHEET1 will have single row (just the latest version) for each trade.

compare COLUMNS
SHEET1 SHEET2
row H row J
row I row K
row M row O
row p row p
row Q row S
row W row Y
row X row Z


I'm not sure if above is clear, if you're not then feel free to call me on 07710056521 or email me nasira254@gmail.com

if you can you help me do this in LOOP and IF coding then I can apply this to few other projects I must do to save hours of work.

Many thanks
Nasir


RE: Comparing data with IF function

Hi Nasir,

Thank you for the forum question and sorry that we haven't responded earlier.

It is not an easy task. You will need at least 3 loops. One to loop through the records on each sheet and one to loop through the reference which is on both sheets to find the latest version. I can help you get started. I will send you a workbook to your email address. In the workbook you will find to sheets. The code will find duplicates and remove them from sheet 1.




Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Thu 1 Dec 2016: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Line breaks in a cell

You can control the line breaks for multiple-line headings or labels in your Microsoft Excel worksheet, just like you do in Microsoft Word. Here's how to do it.

Click the cell where you want the label or heading to appear.
Type the first line of information.
Press ALT+ENTER.

View all Excel hints and tips


Server loaded in 0.08 secs.