string sorting problem

  • Thread starter Thread starter NikkoW
  • Start date Start date
N

NikkoW

I have four workbooks, each containing a list of customer names and the
number of products they have ordered from us. I can't combine the lists into
one because there are too many entries. A given customer's name could appear
in more than one of the workbooks.

I need to combine all entries, across all four books, for one customer at a
time, and write that name once and the sum of all products they ordered into
a fifth workbook.

I have sorted each workbook by name and written most of the code for the
project. What I am missing:

How do I compare strings to sort alphabetically?
 
Use the sumif function

tot = 0
for i = 1 to 4
tot = tot + application.Sumif( _
workbooks(1).Worksheets(1).Range("A:A"), customer_name, _
workbooks(1).Worksheets(1).Range("B:B")
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top