Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How to match to Worksheets

Hi,

Here is my problem. I have two Sheets with the following data:

sheet 1 sheet2

country sales country sales
US 100 Spain
US 300 Spain
US 400 Spain
France 500 US
France 600 US
France 700 US
Germany 200 US
Germany 150 US
Germany 350 France
France
France
France
France
France
Germany
Germany
Germany

I want to match to each country in sheet 2 the sales in sheet1. if i use
Vlookup i'll always get the first result(i.e for US i'll get 100, for France
500...). if US appears more times in sheet 2 than in sheet1, I want the cell
in sheet2 to be empty.
please advise how could i do it?

thanks,
David Messika



  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 913
Default How to match to Worksheets

On Wed, 17 Dec 2008 08:52:07 -0800, ??? ?????
wrote:

Hi,

Here is my problem. I have two Sheets with the following data:

sheet 1 sheet2

country sales country sales
US 100 Spain
US 300 Spain
US 400 Spain
France 500 US
France 600 US
France 700 US
Germany 200 US
Germany 150 US
Germany 350 France
France
France
France
France
France
Germany
Germany
Germany

I want to match to each country in sheet 2 the sales in sheet1. if i use
Vlookup i'll always get the first result(i.e for US i'll get 100, for France
500...). if US appears more times in sheet 2 than in sheet1, I want the cell
in sheet2 to be empty.
please advise how could i do it?

thanks,
David Messika



If your country and sales in Sheet1 are in columns A and B
respectively starting on row 2 (below one header row)
and your country and sales in Sheet2 are also in columns A and B
respectively starting on row 2 (below one header row)
you may try the following formula in cell B2 of Sheet2:

=IF(COUNTIF(A$1:A1,A2)=COUNTIF(Sheet1!A$1:A$100,A 2),"",INDEX(Sheet1!$B$1:$B$100,MATCH(A2,Sheet1!A$1 :A$100,0)+COUNTIF(A$1:A1,A2)))

Adjust the 100 in three places to cover the rows in Sheet1 and copy
the formula down as far as you have countries in column A of Sheet2

Note: For this formula to work I have assumed that the all sales for a
country are grouped together on Sheet1 as this was the case in your
example. If that is not the case, this formula will not work.

Hope this helps / Lars-Åke
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
xlm xlm is offline
external usenet poster
 
Posts: 55
Default How to match to Worksheets

From your example, US have multiple sales with different amount, which sales
amount do you want to show in Sheet2 under sales.


--
If this posting was helpful, please click on the Yes button

Thank You

cheers,









"דוד מסיקה" wrote:

Hi,

Here is my problem. I have two Sheets with the following data:

sheet 1 sheet2

country sales country sales
US 100 Spain
US 300 Spain
US 400 Spain
France 500 US
France 600 US
France 700 US
Germany 200 US
Germany 150 US
Germany 350 France
France
France
France
France
France
Germany
Germany
Germany

I want to match to each country in sheet 2 the sales in sheet1. if i use
Vlookup i'll always get the first result(i.e for US i'll get 100, for France
500...). if US appears more times in sheet 2 than in sheet1, I want the cell
in sheet2 to be empty.
please advise how could i do it?

thanks,
David Messika



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How to match to Worksheets

Thanks for you help
--
בברכה,
דוד מסיקה


"Lars-Ã…ke Aspelin" wrote:

On Wed, 17 Dec 2008 08:52:07 -0800, ??? ?????
wrote:

Hi,

Here is my problem. I have two Sheets with the following data:

sheet 1 sheet2

country sales country sales
US 100 Spain
US 300 Spain
US 400 Spain
France 500 US
France 600 US
France 700 US
Germany 200 US
Germany 150 US
Germany 350 France
France
France
France
France
France
Germany
Germany
Germany

I want to match to each country in sheet 2 the sales in sheet1. if i use
Vlookup i'll always get the first result(i.e for US i'll get 100, for France
500...). if US appears more times in sheet 2 than in sheet1, I want the cell
in sheet2 to be empty.
please advise how could i do it?

thanks,
David Messika



If your country and sales in Sheet1 are in columns A and B
respectively starting on row 2 (below one header row)
and your country and sales in Sheet2 are also in columns A and B
respectively starting on row 2 (below one header row)
you may try the following formula in cell B2 of Sheet2:

=IF(COUNTIF(A$1:A1,A2)=COUNTIF(Sheet1!A$1:A$100,A 2),"",INDEX(Sheet1!$B$1:$B$100,MATCH(A2,Sheet1!A$1 :A$100,0)+COUNTIF(A$1:A1,A2)))

Adjust the 100 in three places to cover the rows in Sheet1 and copy
the formula down as far as you have countries in column A of Sheet2

Note: For this formula to work I have assumed that the all sales for a
country are grouped together on Sheet1 as this was the case in your
example. If that is not the case, this formula will not work.

Hope this helps / Lars-Ã…ke

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
Match similar phrases from 2 worksheets Sharon Excel Worksheet Functions 2 April 5th 08 10:45 PM
Match & combine rows from 2 worksheets Doug Excel Worksheet Functions 6 February 6th 07 05:59 PM
MATCH function through multiple worksheets [email protected] Excel Worksheet Functions 1 December 27th 05 09:13 PM
Look for match on two worksheets roy.okinawa Excel Worksheet Functions 2 December 16th 05 12:28 AM
Can you match records from two different worksheets Phil Excel Worksheet Functions 5 October 14th 05 09:15 PM


All times are GMT +1. The time now is 11:50 PM.

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"