Nov 05 2023 10:42 AM - edited Nov 05 2023 11:02 AM
hi Everyone
Book1.xls has 213 list of variables on the rows side and on the columns side, you have list of 15 vendors which provide those variables.
Client simply would like to know which vendors to buy from starting by the one that has the most variables, then the next one that covers the majority remaining then the next. Client would like to see multiple scenarios of going with every vendor and then design an overlap map
So the task is to produce "any to any" comparison. Basically task is to present multiple scenarios by showing Vendor A variables (indicated by 1 if available or 0 if not. Can be changed to yes/no, or true/false) then showing next vendor maybe B that cam cover most of the remaining variables from vendor A, then vendor C showing again the remaining variables from Vendor A and B.
Then repeating the above with vendors A, then C, then B then D... till closing all 15 vendors
Then restarting the whole process with Vendor B at the center and finding the minimum list of vendors to close needed variables in an iterative manner.
I know this is complicated and I dont even know where to start. I am hoping brilliant minds like yours can propose a solution for that.
if you wish to transpose the data if this makes the process easier that's fine.
Nov 05 2023 04:30 PM
Nov 05 2023 09:20 PM
Nov 06 2023 01:44 AM
@samery Just wondering, is the file you provided complete? There currently are no scenarios where all of the variables are covered. If you filter out all of the 1's, you're left with a list of 21 variables that none of the companies are covering.
Nov 06 2023 08:51 AM
Nov 06 2023 09:47 PM
Nov 06 2023 11:27 PM
Nov 07 2023 02:06 AM
You are right probably, I am complicating things.
Please redownload the file again and go to cell B235. The idea is to show what every vendor can provide and then the extra variables that the next vendor can provide above and beyond the variables provided by the previous providers. IS this now clear?
Nov 07 2023 06:48 AM
Solution@samery Are you using Excel for MS365? If so, here's a couple of recursive formulas you could try. However, they will only return the most optimized combination of vendors...
To return a summary of the optimal combination of vendors with their total items covered, try the following formula in any cell (with nothing below it):
=LET(
F, LAMBDA(X,head,data,val, LET(
a, BYCOL(data, LAMBDA(col, SUM(col))),
b, MAX(a),
c, XMATCH(b, a),
IF(b=0, val, X(X, head, FILTER(data, INDEX(data,, c)=0, 0),
VSTACK(val, HSTACK(INDEX(head, c), b)))))),
F(F, C1:Q1, C2:Q231, {"Company","Total Covered"}))
With your current data, the results should look something like this:
Company | Total Covered |
S&P | 138 |
Oxford eco0mics | 28 |
ECONDB | 20 |
Kpler | 11 |
blue water | 5 |
alphaliner | 2 |
economist intelligence | 2 |
Sinay | 1 |
Oxford Analytica | 1 |
TDM | 1 |
To return a detailed list of the optimal combination of vendors with all of their items covered, try the following formula in any cell (will nothing below it):
=LET(
F, LAMBDA(X,head,data,val, LET(
a, BYCOL(data, LAMBDA(col, SUM(col))),
b, MAX(a),
c, XMATCH(b, a),
d, INDEX(head, c),
IF(b=0, val, X(X, head, FILTER(data, INDEX(data,, c)=0, 0),
VSTACK(val, IFNA(HSTACK(d, FILTER(TAKE(data,, 1), INDEX(data,, c)=1)), d)))))),
F(F, B1:Q1, B2:Q231, {"Company","Items Covered"}))
Finally, to return a list of all items not covered by any vendor, try the following formula in any cell (with nothing below it):
=LET(
data, B2:Q231,
qty, BYROW(data, LAMBDA(r, SUM(r))),
VSTACK("Items Not Covered", FILTER(TAKE(data,, 1), qty=0, "none")))
It's a start, anyways. I'll think about it some more and try to find a way to generate other combinations of vendors.
Nov 07 2023 02:40 PM
Nov 07 2023 08:58 PM
Nov 07 2023 09:07 PM - edited Nov 08 2023 02:28 AM
just a question please:
in this formula:
=LET(
F, LAMBDA(X,head,data,val, LET(
a, BYCOL(data, LAMBDA(col, SUM(col))),
b, MAX(a),
c, XMATCH(b, a),
IF(b=0, val, X(X, head, FILTER(data, INDEX(data,, c)=0, 0),
VSTACK(val, HSTACK(INDEX(head, c), b)))))),
F(F, C1:Q1, C2:Q231, {"Company","Total Covered"}))
The result indicates that S&P should be the lead which is obvious then all the other vendors were added very nicely depending on the extra variables that they provide on top of the previous one. This is what the client wants which is great. But it assumes all variables have equal weighting. Client is saying what if vendor X say Factset which has the least number of variables but nonetheless carries better coverage. So client says what if we trigger another scenario by starting not with a top vendor rather any other vendor as the start then align all the other vendors cumulatively till we close as much as possible the remaining variables.
Now from a sorting standpoint, the result is the same but from a variable importance standpoint the client is insisting on having visibility on all scenarios and then he can conclude depending on other factors (such as coverage, weight, refresh rate,.... and many other stuff which are not mentioned to avoid complication).
So may I ask you the following:
How can please revise your formula to rerun the same logic on each and every vendor (clearly in different tables)? in other words, can your formula be reprogrammed to start with a vendor not as the top in terms of number of variables but as a variable in a cell then a formula would work its way towards the other vendors to add remaining vendors?
Nov 07 2023 11:18 PM
@samery Please see the attached workbook (Book2.xlsx). Sheet2 is setup for you to select the first vendor to start with, then the formulas will generate the optimal combination of additional vendors thereafter.
I've also completed the summary you were aiming for on Sheet1, but it's not an optimized summary, as it just goes through the list of vendors in the order that they appear (not by the number of items they cover).
Also worth noting, the number of possible combinations with 15 different vendors is 15! = 1,307,674,368,000. So, the prospect of getting all possible combinations is not very realistic. I think the best combination of results are demonstrated on Sheet2, although they are still weighted by the next vendor with the maximum number of items remaining. Perhaps there could be a way to weight them by other factors, but I would need to see what those factors are.
Hopefully the attached workbook will provide you with enough scenarios. Cheers!
Nov 08 2023 02:13 AM
You seem to have more exchanges since I last looked.
What I have tried is a brute force approach of selecting combinations from the vendor list. Ultimately there are 32768 combinations and the 'best' result is simply use all vendors. What I have done is limit the search to 3 or 4 vendors and list the combinations that give the highest variable count.
The combinations are generated by converting a sequence to binary and splitting the bits across the row. I sort that by the count of set bits and truncate the list to give the number of options considered.
Nov 08 2023 02:51 AM
Nov 08 2023 02:52 AM
Nov 08 2023 08:30 AM - edited Nov 08 2023 08:32 AM
hi again
I promise I will leave you alone after this last post so please bear with me.
you noticed I hinted earlier some other complications related to variables such as refresh rate and scope.
I tried to adjust your great work all by myself but I didnt know how to do it.
First: Please check the attached book2.xls, tab Raw data, it has the actual replica of what I have along with 2 other descriptive fields for every variable: the refresh rate and the scope. I know that this data is not available for all variables.
Second: now please go back to the 2nd tab you created, basically I am supposed to add couple of more fields for every data from the raw data tab so that the client would know what exactly he is buying. Obviously, I should pickup the refresh rate and the scope of the relevant vendor.
Such information should help my client to decide whether or not to buy a particular variable form Vendor X for example if the scope is weak. I also added another simple sum small column next to the nice table you put on the top left on coverage only so that the client will visually see how much before and after, meaning how much client should consumer form vendor vs how much vendor is proving as a simple sum.
do you think you can help me with that as well?
many thanks in advance.
Regards
Samer.
Nov 08 2023 10:44 AM
@samery Please see the newly attached workbook (Book3.xlsx). I moved all of the custom functions to Name Manager and added the ability for you to manually select multiple vendors (up to 5). They will be prioritized in the order you choose, then all subsequent vendors will automatically be filled based on the number of remaining items they can cover.
In order to get the Refresh and Scope variables to pull in, I had to modify the headers slightly on the RawData sheet... all merged headers were unmerged and repeated across their applicable columns. I also verified the Target Data labels on Sheet1 were identical to those on the RawData sheet. All headers and labels must match in order to pull in the additional information.
I wasn't exactly sure what you wanted the Full Coverage column to do, so I set it up to pull the values from the total row on Sheet1 for each vendor in the list. If that's not what you wanted, please try to explain it again.
Nov 08 2023 08:54 PM
Nov 07 2023 06:48 AM
Solution@samery Are you using Excel for MS365? If so, here's a couple of recursive formulas you could try. However, they will only return the most optimized combination of vendors...
To return a summary of the optimal combination of vendors with their total items covered, try the following formula in any cell (with nothing below it):
=LET(
F, LAMBDA(X,head,data,val, LET(
a, BYCOL(data, LAMBDA(col, SUM(col))),
b, MAX(a),
c, XMATCH(b, a),
IF(b=0, val, X(X, head, FILTER(data, INDEX(data,, c)=0, 0),
VSTACK(val, HSTACK(INDEX(head, c), b)))))),
F(F, C1:Q1, C2:Q231, {"Company","Total Covered"}))
With your current data, the results should look something like this:
Company | Total Covered |
S&P | 138 |
Oxford eco0mics | 28 |
ECONDB | 20 |
Kpler | 11 |
blue water | 5 |
alphaliner | 2 |
economist intelligence | 2 |
Sinay | 1 |
Oxford Analytica | 1 |
TDM | 1 |
To return a detailed list of the optimal combination of vendors with all of their items covered, try the following formula in any cell (will nothing below it):
=LET(
F, LAMBDA(X,head,data,val, LET(
a, BYCOL(data, LAMBDA(col, SUM(col))),
b, MAX(a),
c, XMATCH(b, a),
d, INDEX(head, c),
IF(b=0, val, X(X, head, FILTER(data, INDEX(data,, c)=0, 0),
VSTACK(val, IFNA(HSTACK(d, FILTER(TAKE(data,, 1), INDEX(data,, c)=1)), d)))))),
F(F, B1:Q1, B2:Q231, {"Company","Items Covered"}))
Finally, to return a list of all items not covered by any vendor, try the following formula in any cell (with nothing below it):
=LET(
data, B2:Q231,
qty, BYROW(data, LAMBDA(r, SUM(r))),
VSTACK("Items Not Covered", FILTER(TAKE(data,, 1), qty=0, "none")))
It's a start, anyways. I'll think about it some more and try to find a way to generate other combinations of vendors.