+ Reply to Thread
Results 1 to 18 of 18

cell selection and data entry in binary matrix

  1. #1
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    cell selection and data entry in binary matrix

    Hi excel world,

    I'm running into a bit of a roadblock, and I'm hoping someone might have some helpful suggestions -

    I've set up a binary matrix, such that I have 421 unique headings repeated twice: once in each column and once in each row (i.e., in the matrix the headings for row 5 and column 5 will trace back to the same description in the column headings and in the row headings).

    I need to fill in 1s (case satisfied) or 0s (not satisfied) in this 421X421 matrix. Where my problem lies is in finding the exact row-column cell combination in which I need to enter the 1s. Descriptions that belong to the same group or category will be marked by these 1s in the matrix. For example, if I have descriptions 5, 9, 13, and 17 belonging to the same group I need to enter a 1 in each possible combination of these numbers: {5,9} {5,13} {5,17} {9,13} {9,17} {13,17}. I need a quick formula that will compute all possible combinations for inputted descriptions AND will enter a 1 into the cells, which correspond to these combinations.

    I apologize if this is unclear. Explaining the setup in words is proving difficult.

    Any assistance would be a great help as I'm running out of time with these analyses!

    Cheers,

    Nick

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: cell selection and data entry in binary matrix

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: cell selection and data entry in binary matrix

    Hi,

    "...each possible combination of these numbers: {5,9} {5,13} {5,17} {9,13} {9,17} {13,17}"

    Presume then that an addendum to this is "where the row (or is it column?) value is strictly greater than the column (row?) value", so that {5,5}, {9,5), {13,5}, etc. are disallowed?

    Presuming the first entry in your matrix will be in cell B2, and your group is in cells A1:A4 of Sheet2, something like this formula in B2 and copied across and down:

    =IF(AND(B$1>$A2,ISNUMBER(MATCH(B$1,Sheet2!$A$1:$A$4,0)),ISNUMBER(MATCH($A2,Sheet2!$A$1:$A$4,0))),1,"")

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    I've attached an example spreadsheet.

    The headings are listed as "unique x" across 16 rows and mirrored across 16 columns. I created 5 mock categories, and labeled them in the AFTER sheet. Each cell with a 1 in it denotes that those two 'items' belong to the same category. So, for say, category 2 in my example workbook (items 5, 7, 14, 15), 1s are entered in the cells pertaining to each possible combination of those items: {5,7}{5,14}{5,15}{7,14}{7,15}{14,15}

    After all 1s are entered into the cells for each category, 0s will be entered into those cells that remain blank.

    What I need is an automated method of doing this because my matrix is rather large and manual entry would take eons.
    Attached Files Attached Files

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: cell selection and data entry in binary matrix

    sorry im having a thick moment! can you simplify further?

  6. #6
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: cell selection and data entry in binary matrix

    "...category 2 in my example workbook (items 5, 7, 14, 15)"

    Sorry but I can't find any trace of this, or any other, category in the sheet you posted.

    Regards

  7. #7
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: cell selection and data entry in binary matrix

    See attached file.

    HTH,
    WindKnife
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    Thanks WindKnife (and to the others),

    I'm trying to wrap my head around the function you created. If you wouldn't mind, could you translate it into the vernacular of an excel newbie like myself? I'm going to try and apply what you did to my main workbook and play around with the data. Much appreciated!

    Nick

  9. #9
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    Specifically, the parts of the function "," that are concatenated to the specified rows/columns. I haven't come across this before ... thanks!

  10. #10
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    WindKnife,

    I've made attempts to apply the formula to my master sheet, but I can't seem to figure it out. In the example I provided, there were 5 mock categories in a 17X17 matrix. In the real file, the number of categories are not set (although they will probably be around 15) and the matrix is 421x421. I've tried increasing the range while introducing a sixth mock category, but to no avail: The formula returns a false, or in our case a 0, where it should be true, or a 1. Any ideas? I'm pressed for time and losing hair by the second it seems!

  11. #11
    Registered User
    Join Date
    05-21-2013
    Location
    Florida, US
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: cell selection and data entry in binary matrix

    Look at this:
    The input sheet was constructed manually: If your input sent has the potential to get complex, we can
    think of a macro to generate the input columns.

    Otherwise this should serve your purpose. Since the formulas are arrays I am not sure if
    performance will be a factor.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: cell selection and data entry in binary matrix

    Maybe, you can upload your sample file.
    I think you forgot to committed with Ctrl+Shift+Enter.
    By the way, I modified the formula for all cells.
    See attached file.

    WindKnife
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    Hi WindKnife,

    Thanks again for the help. Everything seemed to be working until I got up into the higher values of my matrix. I'm thinking the function doesn't apply to triple-digit numbers. What do you think? I was so close to having it finalized! Thanks again - your generosity is appreciated ...

    Nick

  14. #14
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: cell selection and data entry in binary matrix

    I have tried to test a 150x150 matrix. I don't find any error data.
    You can upload a dummy file with error situation.

    WindKnife

  15. #15
    Registered User
    Join Date
    07-04-2013
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: cell selection and data entry in binary matrix

    Sure thing. Here's a working example of a 200X200 matrix.

    In the first two categories (10,20,30,40,50 & 90,99,91,5) the function returns the 1s in the respective cell combinations. But when I introduce triple digit numbers (98,100,101,102) in the third category, the 1 doesn't appear where it should.

    I'm scratching my head over here...!
    Attached Files Attached Files

  16. #16
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: cell selection and data entry in binary matrix

    why do you insist on having the items all in one cell? its easier to type them in separate cells than including a , between each in one. you are just creating extra work for yourself and not really using the worksheet as its designed to be used

  17. #17
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,005

    Re: cell selection and data entry in binary matrix

    You get a wrong answer because you type "98100101102" in a cell.
    You must type 98,100,101,102 in this cell, or '98,100,101,102 .

    WindKnife
    Attached Files Attached Files

  18. #18
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: cell selection and data entry in binary matrix

    still seems overcomplicated for a relatively simple task

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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