#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Loops

in D5 put in
=sumproduct(Countif('[A.xls]Sheet1'!A:A,C4:C200))

for a total of items in B found in A

=Countif('[A.xls]Sheet1'!A:A,C4) in D5, then drag down the column for a
count of how many times the items in column C are found in workbook A.

Adjust the reference to workbook A to reflect the location/sheet where the
data to be searched is located.

Regards,
Tom Ogilvy



"Dave" wrote in message
...
Hi,

Could some one please advise me on how to go about the following:

I have two Excel files - A:: a list of products, and B:: the products

that
each customer has ordered.

So what I would like to do would be to have a macro that would go through
sheet B ( column C4 to the end) and then find that item in file A, then
keep a total of how many of that item has been found.

Pseudocode for this would be as follows:

foreach item in File B ( in column C4 to end)
found = false;

foreach item2 in File A ( in column A1 to the end)

if( item == item2){

Dx++; // x is the row that item2 has been found in
found = true;
}
}

if(!found){
msg("Error: Item " + item + " was not found" );
}

}


Thanks






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
loops???? harry buggy Excel Worksheet Functions 2 August 14th 07 06:33 PM
Loops [email protected] Excel Discussion (Misc queries) 2 October 14th 06 02:52 PM
Loops... Willabo Excel Discussion (Misc queries) 2 June 14th 06 04:08 PM
do loops saravanan Excel Worksheet Functions 0 June 13th 06 10:53 AM
Using For - Next Loops in VB Biomed New Users to Excel 4 March 22nd 05 07:12 PM


All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"