Cool! O.K. I would like column 'I' to be the content of 'A' that was found
in 'E'. Column 'J' would be the sum of 'D' (on the same row as 'A') and 'H'
on same row matching content s of 'A'
For example:
Col. A B C D E F G H I J
eee-123 CA xxx 100 aaa-123 CA xxx 100 eee-123 0 =SUM(D1-H3)
eee-256 CA xxx 105 bbb-256 CA xxx 101
efd-111 CA xxx 101 eee-123 CA xxx 100
elu-2001 CA xxx 103 efd-111 CA xxx 101
elu-2002 CA xxx 104 elu-2001 CA xxx 103
kjl-123 CA xxx 102 elu-2003 CA xxx 104
fff-256 CA xxx 105 kjl-123 CA xxx 102
IF(A1 is found in column E, go back to row1 column D and
subtract that amount from row3 column H
I hope that helps.
Kimberly
Your use of the word "Sum" and the word "subtract" is confusing. I
think you mean subtract. If you were using a formula for that you would use
=D1-H3, not =SUM(D1-H3), although both give the same answer.
The following macro will do what I think you want. This macro will operate
on the active sheet. This macro loops through all the values in Column A
and searches for each of these values in Column E. If the value is found,
the macro will place the value of the Column A item in Column I in the same
row as the column A item. It will also subtract the value in Column H in
the row of the found value in Column E, from the value in Column D in the
row of the value in Column A. This difference will be placed in the same
row as the Column A item. That is a tongue twister! Come back if you need
more. Otto
Sub FindDups()
Dim rColA As Range
Dim rColE As Range
Dim i As Range
Dim FoundCell As Range
Application.ScreenUpdating = False
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Set rColE = Range("E2", Range("E" & Rows.Count).End(xlUp))
For Each i In rColA
If Not rColE.Find(What:=i.Value, LookAt:=xlWhole) Is Nothing
Then
Set FoundCell = rColE.Find(What:=i.Value, LookAt:=xlWhole)
Cells(i.Row, 9).Value = i.Value
Cells(i.Row, 10).Value = i.Offset(, 3).Value -
FoundCell.Offset(, 3).Value
End If
Next i
Application.ScreenUpdating = True
End Sub
> Cool! O.K. I would like column 'I' to be the content of 'A' that was
> found
[quoted text clipped - 74 lines]
>> >> > match is found at all. Any suggestions would be appreciated.
>> >> > Thanks.
Kimberly - 11 May 2008 23:45 GMT
Hey Otto. I have to admit I think this is above my skill level. I attempted
to run the macro and got the following message:
"compile error
syntax error"
with 'Dim rColA As Range' highlighted
What do I do next?
Thanks.
Kim
> Kimberly
> Your use of the word "Sum" and the word "subtract" is confusing. I
[quoted text clipped - 107 lines]
> >> >> > match is found at all. Any suggestions would be appreciated.
> >> >> > Thanks.