+ Reply to Thread
Results 1 to 16 of 16

Items bought together

  1. #1
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Items bought together

    Hi everyone.

    I need some help with a formula which is related a previous thread (see link below).

    http://www.excelforum.com/excel-gene...-data-set.html

    I need a formula which counts the unique number of orders when two items are bought together. The formulas in the thread attached double counts some orders if an order contains more of the same item (hope that makes sense!).

    So in my attached example, item F & A are bought together in 4 separate transactions, and i need a formula to calculate that.

    Hope someone can help.

    Thanks

    Mike
    Attached Files Attached Files

  2. #2
    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: Items bought together

    One way:

    Row\Col
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    S
    T
    U
    V
    W
    X
    Y
    Z
    1
    A A A A A B B B B C C C D D E
    2
    Order
    Item
    Order
    A B C D E F B C D E F C D E F D E F E F F
    3
    1 D 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    4
    2 C 2 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    5
    3 A 3 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
    6
    3 F 4 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    7
    4 B 5 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    8
    5 C 6 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 0
    9
    6 C 7 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
    10
    6 D 8 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    11
    6 E 9 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    12
    7 A 10 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
    13
    7 F 11 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    14
    7 F 12 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    15
    8 D 13 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1
    16
    9 F 14 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
    17
    10 B 15 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    18
    10 E 16 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
    19
    11 A 17 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    20
    12 C 18 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
    21
    13 A 19 1 0 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1
    22
    13 E 20 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    23
    13 F
    24
    14 C 0 0 0 3 4 0 0 1 1 2 1 0 1 0 2
    25
    14 D
    26
    15 C
    27
    16 A
    28
    16 E
    29
    17 D
    30
    18 B
    31
    18 F
    32
    19 A
    33
    19 A
    34
    19 E
    35
    19 F
    36
    20 D


    E3 and across and down: =--(COUNTIFS($A$3:$A$36, $D3, $B$3:$B$36, E$2)>0)
    L3 and across and down: =INDEX($E3:$J3, MATCH(L$1, $E$2:$J$2)) * INDEX($E3:$J3, MATCH(L$2, $E$2:$J$2))
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Hi shg. Thanks for your post.

    I need to present it as a 2x2 item matrix as I am going to apply a heat map to it. I also have lots of items in reality and thousands of orders so i couldn't list out all the possible combinations along the top.

    Thanks

    Mike

  4. #4
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Anyone else got any ideas? thanks

  5. #5
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Hi shg - do you have any ideas of a formula which would provide the answers in a 2x2 matrix?

    Mike

  6. #6
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160

    Re: Items bought together

    Is it ok with this format?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Hi laansesu. Yes that is the format I am after, I now just need the formula which calculates the figures i.e. the number of transactions where the two items have been bought together

    Thanks

  8. #8
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160

    Re: Items bought together

    Used Sumifs in the 2*2 matrix as you desired, you can check the same in the (previous post)attached excel

    But we have to delete the duplicates based on column C concatenated data

  9. #9
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Items bought together

    Will you show sample result for 1 row i,e E3:J3 and E3:E8
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  10. #10
    Forum Contributor
    Join Date
    08-02-2015
    Location
    Hyderabad
    MS-Off Ver
    2007
    Posts
    160

    Re: Items bought together

    Formula at F3 is =SUMIFS($A:$A,$B:$B,$E3,$B:$B,F$2) to Formula at K4 is =SUMIFS($A:$A,$B:$B,$E3,$B:$B,K$2)

    to

    Formula at F8 is =SUMIFS($A:$A,$B:$B,$E8,$B:$B,F$2)

    Is this you required

  11. #11
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Items bought together

    e3=IF($D3=E$2,SUMPRODUCT((COUNTIFS($B$2:$B$35,$D3,$A$2:$A$35,ROW(INDIRECT(MIN($A$2:$A$35)&":"&MAX($A$2:$A$35))))>=2)*1),SUMPRODUCT(((COUNTIFS($B$2:$B$35,$D3,$A$2:$A$35,ROW(INDIRECT(MIN($A$2:$A$35)&":"&MAX($A$2:$A$35))))>0)+(COUNTIFS($B$2:$B$35,E$2,$A$2:$A$35,ROW(INDIRECT(MIN($A$2:$A$35)&":"&MAX($A$2:$A$35))))>0)>=2)*1))
    Please Login or Register  to view this content.
    Try this and copy across

  12. #12
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Hi Laansesu

    Do you have an example spreadsheet with the formula working? I can't seem to make those formulas return the result

    Thanks

    Mike

  13. #13
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Hi nflsales.

    This formula looks great! Thanks for your help.

    How could the formula be adapted if the order number was a number in text format between 15 and 20 digits long?

    Thanks

  14. #14
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Items bought together

    Get unique orders in separate sheet and give the range reference in the formula

  15. #15
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    The real data I am using looks like this

    110225215052815 Curtains
    110225215052815 Curtains
    110225225052818 Quilts + Pillows
    110225235052819 Quilts + Pillows
    110225235052819 Quilts + Pillows
    110225245052820 Curtains
    110225245052820 Curtains
    110225245052820 Home Decor
    110225245052820 Storage
    110225245052820 Tracks & Poles
    110225255052821 Quilts + Pillows
    110225255052821 Quilts + Pillows
    110225265052822 Lighting
    110225275052823 Lighting

  16. #16
    Registered User
    Join Date
    11-07-2008
    Location
    England
    Posts
    24

    Re: Items bought together

    Could you show me in this spreadsheet with the real data?
    Attached Files Attached Files

+ 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. Most frequent items bought together
    By MJB123 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-07-2015, 05:30 AM
  2. Replies: 4
    Last Post: 09-13-2014, 02:02 AM
  3. [SOLVED] Number of items bought between 11:00 and 11:59 for example
    By carrolct in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-28-2014, 02:40 PM
  4. Create a list of bought-out items for various assemblies
    By aimeelou2006 in forum Excel General
    Replies: 2
    Last Post: 04-02-2013, 05:43 PM
  5. [SOLVED] Pricing Lookup based on qty bought
    By [email protected] in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-05-2012, 03:01 PM
  6. total of different items bought per month
    By yeats48 in forum Excel General
    Replies: 1
    Last Post: 03-11-2008, 08:56 AM
  7. Replies: 1
    Last Post: 12-24-2005, 07:15 AM

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