LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,365
Default Comparing two columns

Great. Enjoy!

"Sharon" wrote:

Yes, I did. Thank you so much!
--
S


"JLatham" wrote:

Thanks very much.

Did you get the workbook/formulas from one of my later previous posts:
http://www.microsoft.com/office/comm...d-a9297f84ba90
??

"Sharon" wrote:

You are brilliant!!! You have gone above and beyond what I expected, but I
couldn't have done it without you! Thank you so much.
--
S


"JLatham" wrote:

And here is the double-click method. When you double-click in a cell in D or
J, you get message telling where the value in that cell is duplicated in the
other column.

To put this code in the right place, right-click on the sheet's name tab and
choose [View Code] from the popup list. Copy and paste the code into the
module provided.

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)

Dim tmpResult As String
Dim rngSearch As Range
Dim anySearchCell As Object
Dim searchColumn As String
Dim ReportDuplicates As String

Application.Volatile
If Target.Column = Range("D1").Column Then
'looking for dupes in column J based on value
'in column D
searchColumn = "J"
ElseIf Target.Column = Range("J1").Column Then
'must be looking for dupes in column D based
'on value in column J
searchColumn = "D"
Else
'but if not in J (and wasn't in D) then do nothing
Exit Sub
End If
Cancel = True ' negate the double-click action
Set rngSearch = Range(searchColumn & "1:" & searchColumn _
& Range(searchColumn & Rows.Count).End(xlUp).Row)
For Each anySearchCell In rngSearch
If anySearchCell.Value = Target.Value Then
tmpResult = tmpResult & " " & anySearchCell.Address
End If
Next
If Len(tmpResult) = 0 Then
MsgBox "No Duplicates"
Else
MsgBox "Value " & Target.Value & _
" in " & Target.Address & " duplicated at: " & tmpResult
End If
End Sub


"JLatham" wrote:

Have you got another spare column hanging around? I'd have to use some VB
coding to find exact location of multiple duplicates and report them. This
could be in the form of a user defined function (UDF) that could be used like
a formula in a cell, or it could be written to respond to a double-click on a
cell in column D (or J or both) to report duplicates in the other columns via
a message when a cell in one of those columns is double-clicked.


"Sharon" wrote:

This works perfectly! One more step, if possible?

Is there anyway to find out which rows have the duplicate values? For
instance, if column D2 has a value and there is a duplicate in J6, J7, J8, is
there a way to have it list the cells where the duplicate is located?

I appreciate your help.

--
S


"JLatham" wrote:

Maybe I don't understand well enough, but it looks to me like this would work
(change ranges if necessary)
in first cell in K:
=COUNTIF($J$2:$J$457,D2)0
That will give you TRUE if value in D2 appears anywhere in J2:J456
in first cell in L:
=COUNTIF($D$2:$D$457,J2)0
again, if value in J2 appears anywhere in D2:D457, will return TRUE
finally in first cell in L:
=OR(K2,L2)
Will return TRUE if only K2 is True or only L2 is true or both are True: it
only returns FALSE when both K2 and L2 are false.


"Sharon" wrote:

I have a spreadsheet where I need to compare two columns and get a true,
false value.

Column D

Column J


I need to compare column D to column J: I used the following in column K:

=ISNA(MATCH(D2,$J$2:$J$457,FALSE))

to compare J to D in column L: =ISNA(MATCH(J2,$D$2:$D$457,FALSE))

I can see that the first one is incorrect because there is a duplicate value
in D2 and J6.

Then, I want to have a column where the value returns true if column K or L
is true:

=IF(OR(K2=TRUE,L2=TRUE),TRUE)


I tried th

=VLOOKUP(D2,'Sheet 1'!$J$2:$J$457,2,FALSE)

which I got from another post.

Can someone please tell me how to do this? Thanks.


--
S

 
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
comparing two columns mouhammmmmmmad Excel Discussion (Misc queries) 1 January 19th 07 10:46 PM
Comparing two columns of information with 2 new columns of informa cbuck Excel Discussion (Misc queries) 1 January 16th 07 09:49 PM
comparing two columns [email protected] Excel Discussion (Misc queries) 2 January 26th 06 11:15 PM
comparing columns ~Q Excel Worksheet Functions 1 November 17th 05 07:41 PM
comparing columns Marc Charts and Charting in Excel 1 February 18th 05 02:17 AM


All times are GMT +1. The time now is 02:38 AM.

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"