Hi all,
I am doing an Economics project at college and have come to a complete dead end on a matrix that I am trying to create in Excel 2010. Hopefullysomeone can help me out. The hardest part is probably going to be to describeclearly what I am looking for, I’ll try my best but if anyone needs any moreinfo I’d be very happy to provide.
I’m looking at a theoretical problem where I have a numberof customers and a number of products. Some own a certain product which theyare willing to lend and some need the product and would like to borrow it. Someproducts that borrowers are looking for will be held by multiple clients, someby only one, some by no one at all. There may be no one looking to borrow a productbut there may be many potential borrowers.
If multiple customers hold a product, they would lend inproportion to how much they advertised as having to lend. Ie, if one lender has10 of product ‘aaa’ and the other has 100 but other customers only want toborrow 50, then the first lender would lend 5 and the second would lend 45.
If alternatively, one lender has 10 of product ‘bbb’ and theother has 100 but another customer wants to borrow 500, then both lenders wouldlend all of their supply, but the borrower would only be able to borrow 110 outof the 500 they had demand for.
I want to create a Matrix which shows how much (totalledacross all the products) each customer is lending to and borrowing from eachother customer (I have called my customers, ‘ABC’, ‘DEF’ ‘GHI’ etc). Im lookingfor something like the below. To add some numbers for illustration, let’s saythat in total, customer ABC lent 2 of product ‘aaa’ to DEF and 3 of ‘aaa’ toGHI. Customer ABC also lent 5 of product bbb to DEF (so in total they werelending DEF 7 across the two products). DEF lends 10 of product ccc to ABC. GHI lent4 of ‘aaa’ to DEF. GHI doesn’t lend ABC anything and DEF doesn’t lend GHI anything.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]Lends[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ABC[/TD]
[TD]DEF[/TD]
[TD]GHI[/TD]
[/TR]
[TR]
[TD]Borrows[/TD]
[TD]ABC[/TD]
[TD]x[/TD]
[TD]10[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]DEF[/TD]
[TD]7[/TD]
[TD]x[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]GHI[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD]x[/TD]
[/TR]
</tbody>[/TABLE]
Here is some sample data that shows the sort of scenariosand how I have got the data presented to me.
[TABLE="width: 1078"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] [TABLE="width: 104"]
<tbody>[TR]
[TD] =IFERROR(IF(F3="","",C3/E3),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD] [TABLE="width: 116"]
<tbody>[TR]
[TD] =IFERROR(IF(E3="","",D3/F3),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD] =IFERROR(IF(E3>-F3,(F3*H3),(C3)),"")[/TD]
[TD] =IFERROR(IF(E3>-F3,(D3),(E3*I3)),"")[/TD]
[/TR]
[TR]
[TD]Product[/TD]
[TD]Customer[/TD]
[TD] Supply to lend[/TD]
[TD] Demand to Borrow[/TD]
[TD] Total to lend by product[/TD]
[TD] Total needed by product[/TD]
[TD]Lenders > borrowers[/TD]
[TD] Proportion of supply lent[/TD]
[TD] Proportion of demand met[/TD]
[TD] Amount lent[/TD]
[TD] Amount borrowed[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]ABC[/TD]
[TD] 850,000[/TD]
[TD][/TD]
[TD] 850,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]GHI[/TD]
[TD] 10[/TD]
[TD][/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.09[/TD]
[TD] -[/TD]
[TD]- 5[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]DEF[/TD]
[TD] 100[/TD]
[TD][/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.91[/TD]
[TD] -[/TD]
[TD]- 45[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 50[/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD] 50[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]GHI[/TD]
[TD] 450,000[/TD]
[TD][/TD]
[TD] 450,000[/TD]
[TD]- 15,000[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 1.00[/TD]
[TD] -[/TD]
[TD]- 15,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 15,000[/TD]
[TD] 450,000[/TD]
[TD]- 15,000[/TD]
[TD="align: center"]TRUE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD] 15,000[/TD]
[/TR]
[TR]
[TD]ddd[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 100,000[/TD]
[TD][/TD]
[TD]- 100,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.00[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]eee[/TD]
[TD]ABC[/TD]
[TD] 1,000,000[/TD]
[TD][/TD]
[TD] 1,000,000[/TD]
[TD]- 2,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 1.00[/TD]
[TD] -[/TD]
[TD] 1,000,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]eee[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD] 2,000,000[/TD]
[TD] 1,000,000[/TD]
[TD]- 2,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD]- 1,000,000[/TD]
[/TR]
[TR]
[TD]fff[/TD]
[TD]ABC[/TD]
[TD] 10,000[/TD]
[TD][/TD]
[TD] 210,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]fff[/TD]
[TD]MNO[/TD]
[TD] 200,000[/TD]
[TD][/TD]
[TD] 210,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ggg[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD] 100,000[/TD]
[TD][/TD]
[TD]- 600,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.17[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ggg[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 500,000[/TD]
[TD][/TD]
[TD]- 600,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.83[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]DEF[/TD]
[TD] 10,000[/TD]
[TD][/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.06[/TD]
[TD] -[/TD]
[TD] 10,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 3,000,000[/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD]- 160,000[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]GHI[/TD]
[TD] 150,000[/TD]
[TD][/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.94[/TD]
[TD] -[/TD]
[TD] 150,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 75,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.05[/TD]
[TD] -[/TD]
[TD]- 30,000[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]DEF[/TD]
[TD] 50,000[/TD]
[TD][/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.09[/TD]
[TD] -[/TD]
[TD] 50,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 1,000,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.73[/TD]
[TD] -[/TD]
[TD]- 400,000[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]JKL[/TD]
[TD] 500,000[/TD]
[TD][/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.91[/TD]
[TD] -[/TD]
[TD] 500,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD] 300,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.22[/TD]
[TD] -[/TD]
[TD]- 120,000[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
My full data set will be quite large (probably around 1,000 productsand 50 customers). I am happy to use formulas or VBA code dependent on whatworks. It looks like this should be solvable using pivot tables but I have not beenable to crack it. I’m hoping someone here is more successful than me!
Many thanks
I am doing an Economics project at college and have come to a complete dead end on a matrix that I am trying to create in Excel 2010. Hopefullysomeone can help me out. The hardest part is probably going to be to describeclearly what I am looking for, I’ll try my best but if anyone needs any moreinfo I’d be very happy to provide.
I’m looking at a theoretical problem where I have a numberof customers and a number of products. Some own a certain product which theyare willing to lend and some need the product and would like to borrow it. Someproducts that borrowers are looking for will be held by multiple clients, someby only one, some by no one at all. There may be no one looking to borrow a productbut there may be many potential borrowers.
If multiple customers hold a product, they would lend inproportion to how much they advertised as having to lend. Ie, if one lender has10 of product ‘aaa’ and the other has 100 but other customers only want toborrow 50, then the first lender would lend 5 and the second would lend 45.
If alternatively, one lender has 10 of product ‘bbb’ and theother has 100 but another customer wants to borrow 500, then both lenders wouldlend all of their supply, but the borrower would only be able to borrow 110 outof the 500 they had demand for.
I want to create a Matrix which shows how much (totalledacross all the products) each customer is lending to and borrowing from eachother customer (I have called my customers, ‘ABC’, ‘DEF’ ‘GHI’ etc). Im lookingfor something like the below. To add some numbers for illustration, let’s saythat in total, customer ABC lent 2 of product ‘aaa’ to DEF and 3 of ‘aaa’ toGHI. Customer ABC also lent 5 of product bbb to DEF (so in total they werelending DEF 7 across the two products). DEF lends 10 of product ccc to ABC. GHI lent4 of ‘aaa’ to DEF. GHI doesn’t lend ABC anything and DEF doesn’t lend GHI anything.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]Lends[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]ABC[/TD]
[TD]DEF[/TD]
[TD]GHI[/TD]
[/TR]
[TR]
[TD]Borrows[/TD]
[TD]ABC[/TD]
[TD]x[/TD]
[TD]10[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]DEF[/TD]
[TD]7[/TD]
[TD]x[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]GHI[/TD]
[TD]3[/TD]
[TD]0[/TD]
[TD]x[/TD]
[/TR]
</tbody>[/TABLE]
Here is some sample data that shows the sort of scenariosand how I have got the data presented to me.
[TABLE="width: 1078"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] [TABLE="width: 104"]
<tbody>[TR]
[TD] =IFERROR(IF(F3="","",C3/E3),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD] [TABLE="width: 116"]
<tbody>[TR]
[TD] =IFERROR(IF(E3="","",D3/F3),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD] =IFERROR(IF(E3>-F3,(F3*H3),(C3)),"")[/TD]
[TD] =IFERROR(IF(E3>-F3,(D3),(E3*I3)),"")[/TD]
[/TR]
[TR]
[TD]Product[/TD]
[TD]Customer[/TD]
[TD] Supply to lend[/TD]
[TD] Demand to Borrow[/TD]
[TD] Total to lend by product[/TD]
[TD] Total needed by product[/TD]
[TD]Lenders > borrowers[/TD]
[TD] Proportion of supply lent[/TD]
[TD] Proportion of demand met[/TD]
[TD] Amount lent[/TD]
[TD] Amount borrowed[/TD]
[/TR]
[TR]
[TD]aaa[/TD]
[TD]ABC[/TD]
[TD] 850,000[/TD]
[TD][/TD]
[TD] 850,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]GHI[/TD]
[TD] 10[/TD]
[TD][/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.09[/TD]
[TD] -[/TD]
[TD]- 5[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]DEF[/TD]
[TD] 100[/TD]
[TD][/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.91[/TD]
[TD] -[/TD]
[TD]- 45[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]bbb[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 50[/TD]
[TD] 110[/TD]
[TD]- 50[/TD]
[TD="align: center"]TRUE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD] 50[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]GHI[/TD]
[TD] 450,000[/TD]
[TD][/TD]
[TD] 450,000[/TD]
[TD]- 15,000[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 1.00[/TD]
[TD] -[/TD]
[TD]- 15,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ccc[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 15,000[/TD]
[TD] 450,000[/TD]
[TD]- 15,000[/TD]
[TD="align: center"]TRUE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD] 15,000[/TD]
[/TR]
[TR]
[TD]ddd[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 100,000[/TD]
[TD][/TD]
[TD]- 100,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.00[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]eee[/TD]
[TD]ABC[/TD]
[TD] 1,000,000[/TD]
[TD][/TD]
[TD] 1,000,000[/TD]
[TD]- 2,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 1.00[/TD]
[TD] -[/TD]
[TD] 1,000,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]eee[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD] 2,000,000[/TD]
[TD] 1,000,000[/TD]
[TD]- 2,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD]- 1,000,000[/TD]
[/TR]
[TR]
[TD]fff[/TD]
[TD]ABC[/TD]
[TD] 10,000[/TD]
[TD][/TD]
[TD] 210,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]fff[/TD]
[TD]MNO[/TD]
[TD] 200,000[/TD]
[TD][/TD]
[TD] 210,000[/TD]
[TD] -[/TD]
[TD="align: center"]TRUE[/TD]
[TD] 0.00[/TD]
[TD][/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ggg[/TD]
[TD]DEF[/TD]
[TD][/TD]
[TD] 100,000[/TD]
[TD][/TD]
[TD]- 600,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.17[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]ggg[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 500,000[/TD]
[TD][/TD]
[TD]- 600,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD][/TD]
[TD]- 0.83[/TD]
[TD] -[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]DEF[/TD]
[TD] 10,000[/TD]
[TD][/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.06[/TD]
[TD] -[/TD]
[TD] 10,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 3,000,000[/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 1.00[/TD]
[TD] -[/TD]
[TD]- 160,000[/TD]
[/TR]
[TR]
[TD]hhh[/TD]
[TD]GHI[/TD]
[TD] 150,000[/TD]
[TD][/TD]
[TD] 160,000[/TD]
[TD]- 3,000,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.94[/TD]
[TD] -[/TD]
[TD] 150,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]ABC[/TD]
[TD][/TD]
[TD] 75,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.05[/TD]
[TD] -[/TD]
[TD]- 30,000[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]DEF[/TD]
[TD] 50,000[/TD]
[TD][/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.09[/TD]
[TD] -[/TD]
[TD] 50,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]GHI[/TD]
[TD][/TD]
[TD] 1,000,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.73[/TD]
[TD] -[/TD]
[TD]- 400,000[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]JKL[/TD]
[TD] 500,000[/TD]
[TD][/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] 0.91[/TD]
[TD] -[/TD]
[TD] 500,000[/TD]
[TD] -[/TD]
[/TR]
[TR]
[TD]iii[/TD]
[TD]MNO[/TD]
[TD][/TD]
[TD] 300,000[/TD]
[TD] 550,000[/TD]
[TD]- 1,375,000[/TD]
[TD="align: center"]FALSE[/TD]
[TD] -[/TD]
[TD]- 0.22[/TD]
[TD] -[/TD]
[TD]- 120,000[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
My full data set will be quite large (probably around 1,000 productsand 50 customers). I am happy to use formulas or VBA code dependent on whatworks. It looks like this should be solvable using pivot tables but I have not beenable to crack it. I’m hoping someone here is more successful than me!
Many thanks