Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / May 2008

Tip: Looking for answers? Try searching our database.

Comparing sets of data, where criteria met, sum certain columns.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kimberly - 09 May 2008 19:14 GMT
Microsoft 2003 - I have to compare data extracted from one application to
data extracted from another application and resolve all discrpancies between
the two files.  Any ideas on how to do this?
The file has 8 columns - 4 from one application and 4 from the other
application (columns a1:d55 is company "XYZ", columns e1:h500 is company
"ABC").  I need the formula to subtract the contents of column 'd' from
column 'h' where contents of column 'a' are found in column 'e'.  These are
not always on the same row.  Sometimes the match occurs on row one of column
'a' and row three of column 'e'.  In  addition it is also possible that no
match is found at all.  Any suggestions would be appreciated.  Thanks.
Otto Moehrbach - 09 May 2008 20:22 GMT
You want to take every value in Column A and find a match of that value
anywhere in Column E, if it's there.  If it is there, you want to subtract
the value in Column D, in the row of the Column A item, from what's in
Column H in the row of the same item found in Column E.  Is that right?
Question:  Where do you want the result of the subtraction to be placed?
Another question:  Do the items in Column A appear, if at all, only once in
Column E.  If they appear more than once, what do you want to do with each
one?  HTH  Otto
> Microsoft 2003 - I have to compare data extracted from one application to
> data extracted from another application and resolve all discrpancies
[quoted text clipped - 9 lines]
> 'a' and row three of column 'e'.  In  addition it is also possible that no
> match is found at all.  Any suggestions would be appreciated.  Thanks.
Kimberly - 09 May 2008 21:52 GMT
Thanks so much for the quick response, Otto!
To answer your questions -
yes, "subtract the value in Column D, in the row of the Column A item, from
what's in Column H in the row of the same item found in Column E"
I would like the results in column I (the lookup) and J (sum of the values)

yes - items in A should only occur once in column E

> You want to take every value in Column A and find a match of that value
> anywhere in Column E, if it's there.  If it is there, you want to subtract
[quoted text clipped - 17 lines]
> > 'a' and row three of column 'e'.  In  addition it is also possible that no
> > match is found at all.  Any suggestions would be appreciated.  Thanks.
Otto Moehrbach - 09 May 2008 23:58 GMT
Kimberly
You say:
I would like the results in column I (the lookup) and J (sum of the values).
Of what row?  The row of the Column A item or the row of the Column E item?
Also, what is the "the lookup" that you want in Column I?  I take the "sum
of the values" to mean the difference that you want calculated.  FYI, I plan
on writing a macro to do this.  Otto
> Thanks so much for the quick response, Otto!
> To answer your questions -
[quoted text clipped - 33 lines]
>> > no
>> > match is found at all.  Any suggestions would be appreciated.  Thanks.
Kimberly - 10 May 2008 01:27 GMT
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
> You say:
[quoted text clipped - 40 lines]
> >> > no
> >> > match is found at all.  Any suggestions would be appreciated.  Thanks.
Otto Moehrbach - 10 May 2008 17:09 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.