Solved

How to compare 3 columns in excel?

Posted on 2016-11-08
7
66 Views
Last Modified: 2016-11-09
I want to compare the field in 3 columns in excel.
I need to check if they have the same content.
For instance if in field A24, C24, E24, I want to check if it has the same content.
If not, I need to be alerted.
Can this be done?
Thanks,
0
Comment
Question by:100questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41879391
If Range("A24") = Range("C24") And Range("A24") = Range("E24") Then
    'Do nothing
Else
    Msgbox "Not the same"
End If

Open in new window

0
 

Author Comment

by:100questions
ID: 41879402
Thanks.
Do I simply add this in an Excel field, to the right of the data?
I need to do this fo many fields, approximately 600 rows of fields.
0
 
LVL 29

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 500 total points
ID: 41879411
Why not apply conditional formatting to identify if A24, C24 and E24 have the same content?
To do so, select the cell A24 and make a New Rule for conditional formatting using the formula given below and format as per your choice. And then select the A24, copy the formatting using the Format Painter and paste into C24 and E24.
So if all the three cells contain the same content, these three cells would be highlighted with the color you chose during formatting.
In the attached, I have applied the conditional formatting for your reference.
=AND($A24&$C24&$E24<>"",$A24=$C24,$C24=$E24)

Open in new window

Conditional-Formatting.xlsx
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41879413
In the attached, the conditional formatting is applied to the range A1:A600, C1:C600 and E1:E600. The borders are there just for reference, you may remove them.
Conditional-Formatting.xlsx
0
 

Author Comment

by:100questions
ID: 41879451
Thanks.
How do I change the sheet so that it refers to columns/fields, D12, I12, N12 instead, and for 700 rows down?
Thanks again.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 41879503
Are you asking Expert Neeraj or me?
0
 
LVL 29

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41879756
Select the range D12:D700 and make a new rule for conditional formatting using the formula given below...
=AND($D12&$I12&$N12<>"",$D12=$I12,$I12=$N12)

Open in new window

Same formula will be used for I12:I700 and N12:N700.

In the attached, the conditional formatting is applied to the above mentioned ranges.
Conditional-Formatting.xlsx
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question