+ Reply to Thread
Results 1 to 9 of 9

Calculate most common combinations

  1. #1
    Registered User
    Join Date
    02-06-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    4

    Question Calculate most common combinations

    Hi,

    I currently make products after a customer places an order which means they have to wait until it has been made before I can deliver, so I want to decide what products to hold in stock so the customer can receive their order immediately. The caveat is that the products I hold in stock must cover the order entirely; if any product is still required to be made then that order cannot be supplied. I would like to have a few options to choose from so I can analyse which is best. Options as below;
    • If I hold 4 items it will cover XX% of orders
    • If I hold 5 items it will cover XX% of orders
    • If I hold 6 items it will cover XX% of orders
    • etc...
    If I hold 'door/bin/table' and my orders are as follows, then I can supply 2 of 3 orders or 66% of orders.
    • door/bin/table (can supply)
    • door/bin (can supply)
    • door/bin/chair (cannot supply)
    Not all orders will have the same number of items.

    I have a large sales database to analyse, but I am unsure how to do the analysis. Any help would be appreciated. I have included dummy data as an example. The aim is to choose the best products to hold in stock to maximise completed orders when holding 2, 3, 4, 5 products etc.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Calculate most common combinations

    For long term research, this sounds like a variation of "market basket analysis" https://en.wikipedia.org/wiki/Market_basket_analysis

    In the short term, what specifically do you need help with? Do you know the algorithm you want to use for this and are having trouble putting it in Excel, or are you not sure where to begin the analysis?

    If the former, explain the algorithm to us, and we should be able to help you program that into Excel.

    If the latter, I would probably start with a pivot table. (http://www.wikihow.com/Create-Pivot-Tables-in-Excel if you are unfamiliar with how to create a pivot table). Order number could be your row labels, product name could be your column labels, and count of product could be your value field. The grand total row and column will show you how many items were part of each order and the grand total row would show you how many orders included each product.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    02-06-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    4

    Re: Calculate most common combinations

    Thanks MrShorty,

    It was the latter; I don't know where to begin the analysis. I am familiar with pivot tables, however I don't think what you have suggested will cover the type of analysis. I'll try to explain as best possible.

    Taking 4 items as an example; I may sell products A, B, C, D, E and F but only want to hold 4 of these in stock, products E and F will be made when a customer orders them. I want to know what the best four products to hold will be so that I can supply the highest % of orders immediately. Therefore if any order has 5 items it is instantly disregarded since I only hold 4 items. So if I hold products A, B, C and D I can immediately supply any customer who orders a 4 or less item order that contains A, B, C or D or any combination of them.

    What I am having trouble with is how to set out the data in Excel so that I can use formulas to calculate the above. I also don't know what formulas I should be using; countif, sumif, if, vlookup, index/match etc.

    It's a tricky one to explain, but I hope that clarifies it somewhat.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Calculate most common combinations

    I am familiar with pivot tables, however I don't think what you have suggested will cover the type of analysis.
    I agree that the pivot table is probably not going to provide the complete analysis. However, I think it would make a useful starting point. In researching a little about this market basket analysis (mba) I mentioned, one tutorial (1st "External Link" in the Wikipedia article I linked to) suggests that the first step in mba is to create a "binarized" table, which is what the pivot table I mentioned should do.

    How I performed this analysis (mostly in my head -- I have not formalized this into Excel functions):

    1) Pivot table
    2) Looking at the totals for each item (these represent the number of times each item was ordered), I see three items that were ordered 5/7 times.
    3) If you had stocked just those three items, I see 4/7 orders that could be filled from only those three items.
    4) If you had stocked those three plus one of the other items, then you would have filled 5/7 orders.

    Is that the kind of analysis you need? If so, it looks like it should be something like:
    5) Choose a stock profile.
    6) Scan through the pivot table to count how many orders that would fill.

    Does that make sense, or am I missing something?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Calculate most common combinations

    I have a large sales database to analyse,
    I think the approach to the problem depends very much on what "large" means. For the small example shown, you could test every combination of 1, 2, ..., N items, calculate the fraction of orders filled (though maybe the value of orders filled would be a better metric), and pick the best at each level.

    When you get to a hundred different items and tens or hundreds of thousands of orders, that would get dog slow.
    Last edited by shg; 02-07-2016 at 03:40 PM.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Calculate most common combinations

    For example,

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    1
    bin
    0
    0
    0
    0
    1
    1
    1
    1
    1
    1
    2
    chair
    0
    1
    1
    1
    0
    0
    0
    1
    1
    1
    3
    door
    1
    0
    1
    1
    0
    1
    1
    0
    0
    1
    4
    stool
    1
    1
    0
    1
    1
    0
    1
    0
    1
    0
    5
    table
    1
    1
    1
    0
    1
    1
    0
    1
    0
    0
    6
    7
    Order
    bin
    chair
    door
    stool
    table
    Met
    Met
    Met
    Met
    Met
    Met
    Met
    Met
    Met
    Met
    8
    1
    1
    0
    1
    0
    1
    0
    0
    0
    0
    0
    1
    0
    0
    0
    0
    G8:{=--AND(($B8:$F8 = 1) * (TRANSPOSE(G$1:G$5) = 1) + ($B8:$F8 = 0))}
    9
    2
    1
    0
    1
    0
    0
    0
    0
    0
    0
    0
    1
    1
    0
    0
    1
    10
    3
    1
    1
    1
    1
    1
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0
    11
    4
    1
    0
    1
    0
    0
    0
    0
    0
    0
    0
    1
    1
    0
    0
    1
    12
    5
    0
    1
    0
    0
    1
    0
    1
    1
    0
    0
    0
    0
    1
    0
    0
    13
    6
    1
    0
    0
    1
    1
    0
    0
    0
    0
    1
    0
    0
    0
    0
    0
    14
    7
    0
    0
    1
    0
    1
    1
    0
    1
    0
    0
    1
    0
    0
    0
    0
    15
    Total
    1
    1
    2
    0
    1
    4
    2
    1
    0
    2

  7. #7
    Registered User
    Join Date
    02-06-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    4
    Thanks, what is suggested seems very logical and makes sense to me. I guess the problem, as suggested, is that I am looking to hold between 5-8 products choosing from about 50 possible products. This equates to millions of possible combinations

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: Calculate most common combinations

    No question that problems like this can balloon and become prohibitively large very quickly. If you have looked through some of the market basket analysis (mba) stuff, I see references to algorithms (such as the "apriori" algorithm https://en.wikipedia.org/wiki/Apriori_algorithm ) that are useful for making the analysis more efficient for large data sets. I am not familiar with these algorithms (I don't know if shg is), but it may be useful to research them to see how they work.

    Are you required to program this yourself? As common as mba is, I expect there are pre-programmed applications out there (some of them seem to be quite expensive). The programmers of Excel's Solver offer an XLMiner add-in (it looks expensive). One of the links in the Affinity Analysis Wikipedia page offers tutorial spreadsheet for a few dollars. It might be worth the cost to download -- especially if the algorithms are already programmed in. I also see some open source applications that claim to do mba. Unless you are required to program this yourself, it might be worth the effort and expense to look into 3rd party applications.

  9. #9
    Registered User
    Join Date
    02-06-2016
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    4

    Re: Calculate most common combinations

    MrShorty, you've definitely given me a few avenues to explore that I hadn't previously been aware of. I'm not required to code this myself so I will look into existing algorithms

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Combining two lists of names and all combinations based on a separate common value
    By Speshul in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2015, 12:31 PM
  2. Getting Excel to Calculate All Combinations of a Set of Data?
    By marello in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 04-19-2013, 02:21 PM
  3. Editing code to show common four-word combinations in a column
    By Glayva in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-07-2011, 09:06 AM
  4. Calculate Combinations
    By Adebishop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2011, 10:09 AM
  5. Replies: 3
    Last Post: 01-24-2011, 04:15 PM
  6. How to Calculate Combinations ?
    By Jacko in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2005, 01:06 PM
  7. how to calculate a value for 49 possible combinations
    By crimsonkng in forum Excel General
    Replies: 4
    Last Post: 07-18-2005, 09:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1