Compare 2 lists to capture discrepencies

maramiro

Board Regular
Joined
Mar 17, 2009
Messages
67
<o:p> </o:p>
I have two lists of emails to compare with each other.<o:p></o:p>
The first list is on excel, and the second list is on word.<o:p></o:p>
<o:p> </o:p>
The list of emails on excel is on a column as shown below. <o:p></o:p>
JOHNSMITH@HOTMAIL.COM<o:p></o:p>
MATHEWPETER@HOTMAIL.COM<o:p></o:p>
MARKJACOB@HOTMAIL.COM<o:p></o:p>
PAULDOUMIT@HOTMAIL.COM<o:p></o:p>
<o:p> </o:p>
<tbody> </tbody>
And the second list which is copied pasted from outlook onword is as shown below. All are on the same line.
smith, john <johnsmith@hotmail.com>; mathew, peter<mathewpeter@hotmail.com>; sharma,monica <monicasharma@hotmail.com>;mark, jacob <markjacob@hotmail.com><o:p></o:p>
<o:p> </o:p>
I want to compare both lists to capture discrepancies. <o:p></o:p>
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Thank you....i ll try that.

Correction to my earlier thread:

I have two lists of emails to compare with each other.<o:p></o:p>
The first list is on excel, and the second list is on word.<o:p></o:p>

<o:p></o:p>
The list of emails on excel is on a column as shown below. <o:p></o:p>
JOHNSMITH@HOTMAIL.COM<o:p></o:p>
MATHEWPETER@HOTMAIL.COM<o:p></o:p>
MARKJACOB@HOTMAIL.COM<o:p></o:p>
PAULDOUMIT@HOTMAIL.COM<o:p></o:p>
<o:p></o:p>

<tbody>
</tbody>

And the second list which is copied pasted from outlook onword is as shown below.<o:p></o:p>
smith, john < johnsmith@hotmail.com >; mathew, peter < mathewpeter@hotmail.com > ; sharma,monica < monicasharma@hotmail.com > ; mark,jacob <markjacob@hotmail.com ><o:p></o:p>

<o:p></o:p>
I want to compare both lists to capture discrepancies. <o:p></o:p>
 
Upvote 0
to me this looks like you need VBA for this one, I'm Not sure how to do it, I hope that the link that I sent helps
 
Upvote 0
jamtay317 is correct, you'll need some VBA to achieve this. Whereabouts in Outlook is the list copied from (a mail item, an address list etc)? I ask because rather than using a reference to the Word Object Library and comparing the strings, it might be more useful to go directly to Outlook.
 
Upvote 0
how do i do that? I am familiar a bit with VBA. I do have access to outlook for the complete list of emails.
I just thought it would be easier to copy/paste it in word.
 
Last edited:
Upvote 0
You could alter this code to deal with the matches/discrepancies however you wish

Code:
Sub GetAddressesWord()

Dim wdApp As Object 'Word.Application
Dim strWord As String
Dim rng As Range, c As Range


Set wdApp = GetObject(, "Word.Application")
strWord = LCase(wdApp.ActiveDocument.Range)
Set rng = Sheets(1).Range("A1:A4")


    For Each c In rng
        If InStr(1, strWord, LCase(c)) > 1 Then
            Debug.Print c & " - Matches"
        Else
            Debug.Print c & " - Discrepancy"
        End If
    Next
    
Set rng = Nothing
Set wdApp = Nothing


End Sub

There's no need to add a reference to the Word Object Library (but you can and then replace Object with the comment). You will need to have the Word document open for this to work, and you'll need to change "rng" to the relevant range in your spreadsheet.

Hope this helps

Simon
 
Upvote 0
Thank you....i ll try that.

Correction to my earlier thread:

I have two lists of emails to compare with each other.<o:p></o:p>
The first list is on excel, and the second list is on word.<o:p></o:p>

<o:p></o:p>
The list of emails on excel is on a column as shown below. <o:p></o:p>
JOHNSMITH@HOTMAIL.COM<o:p></o:p>
MATHEWPETER@HOTMAIL.COM<o:p></o:p>
MARKJACOB@HOTMAIL.COM<o:p></o:p>
PAULDOUMIT@HOTMAIL.COM<o:p></o:p>
<o:p></o:p>

<tbody>
</tbody>

And the second list which is copied pasted from outlook onword is as shown below.<o:p></o:p>
smith, john < johnsmith@hotmail.com >; mathew, peter < mathewpeter@hotmail.com > ; sharma,monica < monicasharma@hotmail.com > ; mark,jacob <markjacob@hotmail.com ><o:p></o:p>

<o:p></o:p>
I want to compare both lists to capture discrepancies. <o:p></o:p>
Hi,

I don't think you need VBA to achieve this if your total length of emails from outlook does not exceed 32767 characters (Excel limit)

1. below is the way to convert the outlook emails list to excel cells

copy the whole email list, go to excel, go to cell A1, in the formula bar, Paste the emails

ABC
3Find "<" positionFind ">" positionE-mail address
4=FIND("<", $A$1)=FIND(">", $A$1)=TRIM(MID($A$1, $A4+1, $B4-$A4-1))
5=FIND("<", $A$1, A4+1)=FIND(">", $A$1, B4+1)=TRIM(MID($A$1, $A5+1, $B5-$A5-1))
6=FIND("<", $A$1, A5+1)=FIND(">", $A$1, B5+1)=TRIM(MID($A$1, $A6+1, $B6-$A6-1))

<tbody>
</tbody>

note: formulas of A4 & B4 are different to other cells in that column
for other formulas, you can just drag down

2. I think it would be easy to compare this list to your excel list (either by A to B VLOOKUP & B to A VLOOKUP, or if you like you may use MATCH function to lookup), by both way round then you can see what are the discrepancies between the 2 lists completely
(Excel is not case sensitive for VLOOKUP/MATCH)

Alvin
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top