View Single Post
  #2   Report Post  
Harlan Grove
 
Posts: n/a
Default


"tettrick" wrote...
From a database, I have imported (into Excel) two lists of statistics
by country: (list a) the 20 countries with the largest number of cell
phone users, and (list b) the 20 countries with the highest percentage
of cell phone users. I want to match these two lists by country so
that the names and their corresponding statistical information will
appear in the same row in every case where a country exists in both
lists. For those countries that don’t appear in both lists, I would
like for each of them, along with its corresponding statistical
information, to appear in its own row.

Does Excel 2003 have a function or tool that can reorganize the data
in this way?


Don't you think it'd make a LOT more sense to do an outer join like this in
the database than in Excel?

This can be done in Excel, but not elegantly. Presumably the order in one or
the other list would be controlling. If numbers were controlling, then copy
the numbers table and supplement with another column of percentages. If the
copy of the number table began in cell A1, the formulas for percentages
would be in column C and use formulas like

C1:
=IF(COUNTIF(INDEX(PTBL,0,1),A1),VLOOKUP(A1,PTBL,2, 0),"")

Fill C1 down into C2:C20. Then add lines for the records in the percentages
table that don't appear in the numbers table.

A21:
=INDEX(PTBL,MATCH(0,COUNTIF(A$1:A20,INDEX(PTBL,0,1 )),0),1)

C21:
=VLOOKUP(A21,PTBL,2,0)

Fill A21:C21 down until they return errors.