View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default correlating data from different worksheets - toughie?

Person wrote...
....
. . . Some of the worksheets contain data in this format:

(Region) (Subregion) (Amount)
1 2 $100
1 2 $400
1 3 $1000
2 1 $300

That is, each region (1 through whatever) contains several
subregions. Every row represents one transaction


Let's call this table TRANS.

There is another worksheet in this workbook, with the following columns:

Manager__Region__Subregion
1________ 1_______ 2
1________ 1_______ 3
2________ 2_______ 1

That is, the second worksheet is basically a lookup table that tells
me which region/subregion each manager has control over. Most
managers control more than one region/subregion.


Call this MRSR.

The Goal: what I'm supposed to do is to fill in a summary worksheet
having the following format (5 columns):

(Manager)(# Trans.) (Amount < $500)(Amount $500-100) (Amount 1000)

That is, I'm supposed to use the lookup table to find out which
manager controls which region & subregion, then summarize the data
by saying how many transactions a given manager has overseen, and
indicating what percentage of that manager's transactions were less
than $500, between $500-$1,000, and greater than $1,000 (by number
of transactions, not by total dollar value).

....

For my own simplicity, I'll assume this result table is in yet another
worksheet with the first manager ID in cell A2.

If the first column of this result table is prefilled with manager IDs
that would be found in the first column of the MRSR table, then the 2nd
through 5th columns would be

B2 [array formula]:
=SUM((INDEX(TRANS,0,1)=TRANSPOSE(IF(INDEX(MRSR,0,1 )=$A2,INDEX(MRSR,0,2))))
*(INDEX(TRANS,0,2)=TRANSPOSE(IF(INDEX(MRSR,0,1)=$A 2,INDEX(MRSR,0,3)))))

C2 [array formula]:
=SUM((INDEX(TRANS,0,1)=TRANSPOSE(IF(INDEX(MRSR,0,1 )=$A2,INDEX(MRSR,0,2))))
*(INDEX(TRANS,0,2)=TRANSPOSE(IF(INDEX(MRSR,0,1)=$A 2,INDEX(MRSR,0,3))))
*(INDEX(TRANS,0,3)<500))/$B2

D2 [array formula]:
=SUM((INDEX(TRANS,0,1)=TRANSPOSE(IF(INDEX(MRSR,0,1 )=$A2,INDEX(MRSR,0,2))))
*(INDEX(TRANS,0,2)=TRANSPOSE(IF(INDEX(MRSR,0,1)=$A 2,INDEX(MRSR,0,3))))
*(INDEX(TRANS,0,3)<=1000))/$B2-SUM($C2:C2)

Fill D2 right into E2. Then select B2:E2 and fill down as far as needed.