Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel compare 2 cell values 3

Status
Not open for further replies.

kyriakos70

Programmer
Jul 24, 2008
87
GR
Hello,
I want to create an excel spreadsheet, the problem is that I want to create a macro or vbscript that will allow me to compare the values of the same column cells but in different rows and when these values are the same to alert me with a message eg. column b and column a of row 1 to compare with column b and column a row 2 cells.
Is there a way to do this?

Thank you in advance
 
How about

=IF(B1=B2,"Alert Alert these values are equal","Do not worry these values are not equal")

“Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.”-Albert Einstein
 
Yes I suppose but I want to do this for any row I mean not only for b1=b2 but if there is a same value anywhere in the column.
 
=countif(A:A, A1)

Anything greater than two is a duplicate.

You could use it in an IF formula like

=if(countif(A:A, A1) > 1, "YES", "")

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 

Hi,

Check out the MATCH function. No match return #NA. Otherwise the range row offset.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
-> Anything greater than two is a duplicate.

should read either "greater than one" or "two or greater"

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
anotherhiggins
Where do I put this formula? I put it on a cell A1 but I cannot give a value to A1 it deletes the formula.
 
Maybe I wasn't clear, I don't want to have double values in a column to alert me when I have the same value in two cells further more I don't want to have the same value when in column B in the same row I have another value same.
eg.
cells A1 has value 12 and B1 has value john in the rest
cells A2 and so I don't want to have the value 12 when in the same row B has the value john but not only for the values of A1 and B1 but for all
eg.
cells A4 has 15 and B4 has Mary I don't want to have the same combination in any other row.
 



You are VERY DIFFICULT to understand.

Please copy some cells from columns A & B.

Show 2 or 3 instances of what you do NOT want to occur.

I want to see some ACTUAL data in columnar format, please.

Make it clear concise and complete.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 

I probably don't understand the issue either, but if it's what I think then a PivotTable might suffice with a count function.

GS

[red]******^*******
[small]I[/small] [small]Love[/small] [♥] [small]Redundancy.[/small][/red]
 
Thank you,
I found that a match with vlookup is what I wanted.

Thank you
 
I'm brand new to Tek-Tips and don't consider myself a techie, but it sounds like you are searching for duplicates in rows. I googled "excel macro look for duplicates" and came across several things that might work for you. Please check out the following link and see if this helps. It includes two macros: one IDs duplicate rows, the other deletes them if you want. You should be able to modify it to meet your exact requirements. Let me know if this helps.

 

Hi GatorBrad,

Welcome to Tek-Tips!

I'm not a techie either, but I learn something cool just about every time I visit Tek-Tips. There are some real whizzes here, and they are generous with their talents. Just don't ask a vague question... [bigsmile]

GS

[red]******^*******
[small]I[/small] [small]Love[/small] [♥] [small]Redundancy.[/small][/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top