Solved

How to compare 3 columns in excel?

Posted on 2016-11-08
7
56 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 28

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 28

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 28

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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,…
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now