How to find missing text or values comparing 2 cells

Closed
g1 - Apr 9, 2015 at 03:53 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Apr 16, 2015 at 11:11 AM
Hello,
i have data in 2 columns, for
ex:
Column A: Bearing, Ball, 1/2 in, Cast Iron
Column B: Bearing, Ball, Cast Iron

by seeing this example we know that 1/2 in is missed in column B, so i need this missed value highlighted in Column C

Please help me to get this solved
Related:

2 responses

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 9, 2015 at 10:52 AM
Hi g1,

The code below will loop through column A, comparing each value to column B. When a value is not found then that value will be pasted to column C.

Here is the code:
Sub RunMe()
Dim lRow As Integer
Dim sValue As Range

lRow = Range("A" & Rows.Count).End(xlUp).Row

For Each cell In Range("A1:A" & lRow)
    Set sValue = Columns("B:B").Find(cell)
    If sValue Is Nothing Then
        Range("C" & Rows.Count).End(xlUp).Offset(1, 0).Value = cell.Value
    End If
Next cell
End Sub

Best regards,
Trowa
0
it is not met my requirement, i need Cell A1 to be compared with Cell B1 and missed value should get in the Cell C1, continuing A2 with B2 and result in C2 and so on.........

Please help me to get this.

Thanx
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 13, 2015 at 11:53 AM
Hi g1,

Ok, that looks a lot simpler.

Use this formula in C1 and drag it down:
=IF(A1=B1,"",A1)

Does this meet your requirements?

Best regards,
Trowa
0
its not working..........can anybody help to get this.........
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 14, 2015 at 11:02 AM
Hi g1,

To me the formula is doing as requested:
A1: Bearing
B1: Bearing
No missed value so C1 is empty

A2: Ball
B2: Ball
No missed value so C1 is empty

A3: 1/2 in
B3: empty
The is a missed value so C1: 1/2 in

All this is achieved by the formula:
=IF(A1=B1,"",A1)

So there must be something you are not telling us.

Could you post some sample data how it is now and how you want it to look like?
Or consider the option to post (a part of) your workbook by using a file sharing site like www.speedyshare.com or ge.tt and post back the download link. Careful with sensitive information.

Best regards,
Trowa
0
g1 > TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022
Apr 15, 2015 at 01:03 AM
thnx, but my need is for ex: in cell A1: "Bearing, 1/2 in, stainless steel" and in Cell B1 "Bearing, 1/2 in" we can see that "stainless steel" is missed in cell B1, i need this missed value in C1
0
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Apr 16, 2015 at 11:11 AM
Hi g1,

Let me give you some general Excel advise.

Don't put multiple values in the same cell. This will make processing your data a lot more easy.

If this data is provided to you this way, then use the Text to Columns option found under the Data ribbon.

Good luck,
Trowa
0