How to find missing text or values comparing 2 cells

[Closed]
Report
-
Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021
-
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

2 replies

Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021
481
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
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
Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021
481
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
its not working..........can anybody help to get this.........
Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021
481
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
>
Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021

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
Posts
2805
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
September 14, 2021
481
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