Formula that output values of all possible permutations

%3CLINGO-SUB%20id%3D%22lingo-sub-1017648%22%20slang%3D%22en-US%22%3EFormula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1017648%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EHi%20all%20-%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EI%20have%20a%20spreadsheet%20with%20raw%20data%20in%20the%20first%20tab.%20All%20the%20other%20tabs%20work%20as%20engines%20as%20in%20they%20get%20data%20from%20a%20pair%20(two%20rows%20only)%20apply%20some%20arithmetic%20formulas%20and%20output%20values.%20How%20can%20I%20get%20those%20engines%20(tabs)%20to%20come%20up%20with%20all%20output%20values%20of%20all%20possible%20pair%20permutations%3F%20See%20below%20an%20explanations%20of%20my%20spreadsheet%20and%20of%20the%20issue%20I%20have%20in%20more%20detail%20-%20thank%20you%20in%20advance%20for%20your%20help%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20the%20first%20tab%20I%20have%20a%20table%20with%2020%20items%20(listed%20across%2020%20rows)%20and%20each%20of%20those%20items%20(listed%20in%20column%20A)%20has%20two%20values%20one%20in%20column%20B%20and%20another%20one%20in%20column%20C.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EApple%2C%20Orange%20and%20Pineapple%20are%20just%203%20of%20those%2020%20items.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20the%20second%20tab%2C%20cell%20A1%20reads%20one%20of%20the%2020%20items%2C%20in%20this%20case%20%E2%80%9Capple%E2%80%9D%2C%20and%20cell%20A2%20reads%20another%20item%20in%20this%20case%20%E2%80%9Corange%E2%80%9D.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ECell%20B1%20is%20the%20sum%20of%20two%20value%20retrieved%20with%20vlooups%20functions.%20The%20first%20vlookup%20retrieves%20the%20value%20in%20the%20second%20column%20of%20the%20item%20in%20A1%20(apple)%20and%20the%20second%20vlookup%20retrieves%20the%20value%20in%20the%20third%20column%20of%20the%20item%20in%20A2%20(apple).%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3ECell%20C1%20is%20the%20subtraction%20of%20two%20value%20retrieved%20with%20vlooups%20functions.%20The%20first%20vlookup%20retrieves%20the%20value%20in%20the%20second%20column%20of%20the%20item%20in%20A1%20(apple)%20and%20the%20second%20vlookup%20retrieves%20the%20value%20in%20the%20third%20column%20of%20the%20item%20in%20A2%20(apple).%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ELet%E2%80%99s%20assume%20that%20the%20value%20of%20the%20first%20vlookup%20value%20is%205%20and%20of%20the%20second%20vlookup%20is%203.%20Said%20so%20the%20value%20in%20B1%20will%20be%208%20and%20the%20value%20in%20C1%20is%203.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20a%20third%20tab%20cell%20A1%20retrieves%20the%20value%20B1%20of%20the%20second%20tab.%20In%20the%20same%20tab%20value%20D1%20multiplies%20the%20value%20in%20A1%20to%20a%20costant%20number%20that%20in%20this%20case%20is%202%20and%20D2%20multiplies%20the%20value%20in%20A1%20to%20a%20costant%20number%20that%20in%20this%20case%20is%203.%20This%20means%20that%20the%20value%20in%20D1%20is%2016%20and%20the%20value%20in%20D2%20is%2024%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20a%20fourth%20tab%20cell%20A1%20retrieves%20the%20value%20C1%20of%20the%20second%20tab.%20In%20the%20same%20tab%20value%20D1%20multiplies%20the%20value%20in%20A1%20to%20a%20costant%20number%20that%20in%20this%20case%20is%204%20and%20D2%20multiplies%20the%20value%20in%20A1%20to%20a%20costant%20number%20that%20in%20this%20case%20is%205.%20This%20means%20that%20the%20value%20in%20D1%20is%2012%20and%20the%20value%20in%20D2%20is%2015.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20a%20fifth%20tab%20cell%20D1%20and%20D2%20of%20both%20the%20third%20tab%20and%20fourth%20tab%20make%20a%202x2%20matrix.%20Each%20value%20is%20multiplied%20by%20another%20value%20to%20output%204%20results.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EThose%204%20results%20are%20retrieved%20in%20the%20second%20tab%20in%20A3%2C%20A4%2C%20A5%20and%20A6.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ESo%20far%20this%20is%20all%20quite%20simple.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%3ENow%20I%20would%20like%20to%20replicate%20this%20exercise%20so%20to%20retrieve%20those%204%20values%20for%20all%20other%20pairs%20of%20items%20of%20the%20table%20in%20the%20first%20tab.%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%3EIn%20other%20words%20if%20A1%20and%20A2%20reads%20%E2%80%9Capple%E2%80%9D%20and%20Orange%E2%80%9D%20and%20now%20I%20write%20in%20B1%20and%20B2%20%E2%80%9Capple%E2%80%9D%20and%20%E2%80%9Cpineapple%E2%80%9D%2C%20could%20you%20tell%20what%20are%20the%20functions%2Fformulas%20that%20could%20help%20B3%2C%20B4%2C%20B5%20and%20B6%20retrieving%20the%20output%20of%20the%20same%20exercise%20I%20have%20done%20in%20A3%2C%20A4%2CA5%2C%20A6%20without%20creating%20new%20tabs%20or%20tables%20but%20having%20all%20the%20calculations%20done%20dynamically%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1017648%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1018448%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1018448%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F462134%22%20target%3D%22_blank%22%3E%40simones7982%3C%2FA%3E%26nbsp%3B%26nbsp%3B%20Is%20it%20possible%20to%20upload%20a%20copy%20of%20the%20sheet%3F%20You'd%20be%20far%20more%20likely%20to%20get%20the%20help%20you're%20seeking%20if%20you%20could%20supplement%20your%20very%20thorough%20description%20with%20the%20spreadsheet%20in%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt's%20hard%20to%20visualize%20what%20you're%20saying%2C%20and%20we'd%20have%20to%20create%20our%20own%20version%20in%20order%20to%20help....you%20can%20greatly%20facilitate%20that%2C%20and%20make%20it%20more%20accurate%20in%20the%20process%2C%20by%20showing%20us%20what%20you're%20working%20with.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1020451%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1020451%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%26nbsp%3B%20You%20are%20totally%20right.%20It%20would%20be%20easier%20to%20try%20to%20help%20me%20if%20I%20share%20the%20spreadsheet.%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20noticed%20I%20have%20made%20some%20mistakes%20when%20I%20described%20the%20spreadsheet.%20Please%20find%20attached%20the%20correct%20spreadsheet.%20I%20have%20also%20reformulate%20the%20question%20of%20what%20I%20am%20trying%20to%20achieve%20in%20the%20first%20tab.%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20help%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1021964%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1021964%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F462134%22%20target%3D%22_blank%22%3E%40simones7982%3C%2FA%3E%3C%2FP%3E%3CP%3EMost%20of%20this%20calculation%20just%20melted%20away.%3C%2FP%3E%3CP%3EIt%20turned%20out%20that%20each%20term%20of%20the%202x2%20matrix%20involved%20the%20product%20of%20calculation%201%20and%20calculation%202%3C%2FP%3E%3CP%3E(%3CEM%3Esince%20they%20are%20the%20sum%20and%20difference%20of%20two%20lookups%20respectively%2C%20their%20product%20is%20equivalent%20to%20the%20difference%20of%20the%20squares%20of%20the%20values%20looked%20up%3C%2FEM%3E)%3C%2FP%3E%3CP%3ETaking%20the%20product%20out%20as%20a%20factor%20of%20the%20matrix%20left%20a%20constant%20matrix%20that%20applies%20to%20every%20data%20row.%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CFONT%3E%3D%20Calc1%20*%20Calc2%20*%20Weighting%3C%2FFONT%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3EFor%20me%20that%20formula%20occupies%20cell%20E2%20and%20spills%20to%20fill%20the%20green%20cells.%20%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EI%20think%20implicit%20intersection%20will%20work%20on%20legacy%20systems%20if%20the%20formula%20is%20copied%20to%20the%20entire%20range.%3C%2FEM%3E%3C%2FP%3E%3CP%3E%3CEM%3EXLOOKUPS%20would%20also%20need%20to%20be%20reverted%20to%20VLOOKUPS%20or%20INDEX%2FMATCH.%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1022110%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1022110%22%20slang%3D%22en-US%22%3EThat's%20going%20to%20take%20some%20time%2C%20which%20I%20don't%20have%20right%20now.%20I%20hope%20there's%20no%20rush%3B%20or%20that%20someone%20else%20will%20feel%20free%20to%20jump%20in.%20It's%20an%20intriguing%20problem%2C%20I%20will%20say.%20Just%20need%20time%20to%20contemplate....%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1022143%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1022143%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F214174%22%20target%3D%22_blank%22%3E%40Peter%20Bartholomew%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Peter%20-%20Thank%20you%20for%20helping%20with%20this.%20This%20is%20much%20appreciated.%26nbsp%3B%3C%2FP%3E%3CP%3EWill%20look%20into%20the%20spreadsheet%20you%20revised%20asap%20and%20revert%20with%20comments.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1022895%22%20slang%3D%22en-US%22%3ERe%3A%20Formula%20that%20output%20values%20of%20all%20possible%20permutations%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1022895%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F462134%22%20target%3D%22_blank%22%3E%40simones7982%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20is%20a%20stab%20at%20producing%20a%20workbook%20that%20uses%20(named)%20relative%20references%20rather%20than%20dynamic%20array%20formulae%20(%3CEM%3Eit%20pains%20me%20to%20do%20it%20and%20I%20cannot%20guarantee%20that%20I%20have%20got%20it%20right%20but%20it%20seems%20to%20be%20working%20on%20my%20computer%3C%2FEM%3E).%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBy%20the%20way%2C%20if%20you%20are%20targeting%20all%20possible%20combinations%20any%20value1%20that%20equals%20a%20value2%20will%20give%20rise%20to%20a%20row%20of%20zeros.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi all -
I have a spreadsheet with raw data in the first tab. All the other tabs work as engines as in they get data from a pair (two rows only) apply some arithmetic formulas and output values. How can I get those engines (tabs) to come up with all output values of all possible pair permutations? See below an explanations of my spreadsheet and of the issue I have in more detail - thank you in advance for your help

In the first tab I have a table with 20 items (listed across 20 rows) and each of those items (listed in column A) has two values one in column B and another one in column C.
Apple, Orange and Pineapple are just 3 of those 20 items.

In the second tab, cell A1 reads one of the 20 items, in this case “apple”, and cell A2 reads another item in this case “orange”.
Cell B1 is the sum of two value retrieved with vlooups functions. The first vlookup retrieves the value in the second column of the item in A1 (apple) and the second vlookup retrieves the value in the third column of the item in A2 (apple).
Cell C1 is the subtraction of two value retrieved with vlooups functions. The first vlookup retrieves the value in the second column of the item in A1 (apple) and the second vlookup retrieves the value in the third column of the item in A2 (apple).

Let’s assume that the value of the first vlookup value is 5 and of the second vlookup is 3. Said so the value in B1 will be 8 and the value in C1 is 3.

In a third tab cell A1 retrieves the value B1 of the second tab. In the same tab value D1 multiplies the value in A1 to a costant number that in this case is 2 and D2 multiplies the value in A1 to a costant number that in this case is 3. This means that the value in D1 is 16 and the value in D2 is 24

In a fourth tab cell A1 retrieves the value C1 of the second tab. In the same tab value D1 multiplies the value in A1 to a costant number that in this case is 4 and D2 multiplies the value in A1 to a costant number that in this case is 5. This means that the value in D1 is 12 and the value in D2 is 15.

In a fifth tab cell D1 and D2 of both the third tab and fourth tab make a 2x2 matrix. Each value is multiplied by another value to output 4 results.
Those 4 results are retrieved in the second tab in A3, A4, A5 and A6.

So far this is all quite simple.

Now I would like to replicate this exercise so to retrieve those 4 values for all other pairs of items of the table in the first tab.
In other words if A1 and A2 reads “apple” and Orange” and now I write in B1 and B2 “apple” and “pineapple”, could you tell what are the functions/formulas that could help B3, B4, B5 and B6 retrieving the output of the same exercise I have done in A3, A4,A5, A6 without creating new tabs or tables but having all the calculations done dynamically?

6 Replies
Highlighted

@simones7982   Is it possible to upload a copy of the sheet? You'd be far more likely to get the help you're seeking if you could supplement your very thorough description with the spreadsheet in question.

 

It's hard to visualize what you're saying, and we'd have to create our own version in order to help....you can greatly facilitate that, and make it more accurate in the process, by showing us what you're working with.

Highlighted

@mathetes  You are totally right. It would be easier to try to help me if I share the spreadsheet. 

I have noticed I have made some mistakes when I described the spreadsheet. Please find attached the correct spreadsheet. I have also reformulate the question of what I am trying to achieve in the first tab. 

Thank you for your help 

Highlighted

@simones7982

Most of this calculation just melted away.

It turned out that each term of the 2x2 matrix involved the product of calculation 1 and calculation 2 (since they are the sum and difference of two lookups respectively, their product is equivalent to the difference of the squares of the values looked up)

Taking the product out as a factor of the matrix left a constant matrix that applies to every data row.

= Calc1 * Calc2 * Weighting

 

For me that formula occupies cell E2 and spills to fill the green cells.  

I think implicit intersection will work on legacy systems if the formula is copied to the entire range.

XLOOKUPS would also need to be reverted to VLOOKUPS or INDEX/MATCH. 

Highlighted
That's going to take some time, which I don't have right now. I hope there's no rush; or that someone else will feel free to jump in. It's an intriguing problem, I will say. Just need time to contemplate....
Highlighted

@Peter Bartholomew 

Hi Peter - Thank you for helping with this. This is much appreciated. 

Will look into the spreadsheet you revised asap and revert with comments. 

Highlighted

@simones7982 

This is a stab at producing a workbook that uses (named) relative references rather than dynamic array formulae (it pains me to do it and I cannot guarantee that I have got it right but it seems to be working on my computer).  

 

By the way, if you are targeting all possible combinations any value1 that equals a value2 will give rise to a row of zeros.