+ Reply to Thread
Results 1 to 12 of 12

more exlusion or inclusion criteria for random match

  1. #1
    Registered User
    Join Date
    10-24-2015
    Location
    United States
    MS-Off Ver
    MS Office 2013
    Posts
    9

    more exlusion or inclusion criteria for random match

    example2.xlsx

    This is my second shot asking this question hopefully I can be more clear this time

    in regard to the attached
    1) for AS4:AU4, I need to further exclude the possible values based on AR4(=AR2). For whatever random value is in AR, I need each recalculation to not include for example, appliance_1-1 in AR4 means AS4:AU4 can anything OTHER than appliance_1-2,1-3,1-4. If AR4 was Appliance_3-3 then then AS4:AU4 could be anything other than 3-1,3-2, and 3-4.
    2) As for AS3:AU3 they can ONLY INCLUDE, for example AR3 is 1-1 then AS3:AU3 has to be any random order of 1-2,1-3,and 1-4
    3) as for AS2:AU2, appliance of any number has to be excluded ,but I'd like to not do this by simply changing the look up value and row references since I have a ton of these is a very large spreadsheet.
    also, AV:AX are irrelevant in this example, so you can ignore them
    Thank you for your time. I could really use some help with this, anything would help
    Last edited by anxiolydiot; 11-05-2015 at 02:41 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: more exlusion or inclusion criteria for random match

    Sorry but I just don't understand what you're getting at. Analysis isn't helped since you have a random factor involved which alters everything every time the sheet changes.

    Can I suggest you offer a few examples where the AR2 Random index is fixed at some value and then manually add the results you expect in AR:AU for a number of rows. Do the same with another fixed index in AR2 and list those results too.

    Knowing what you expect to see is is enormously helpful.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: more exlusion or inclusion criteria for random match

    Results for row 3 and row 4.
    For row 2, I afraid that I am not following your idea. Could you please give few desired outputs?
    Attached Files Attached Files
    Quang PT

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,581

    Re: more exlusion or inclusion criteria for random match

    ARRAY formula in AS2, then drag down.
    Please Login or Register  to view this content.
    ARRAY formula is used

    To enter ARRAY formula
    Paste the formula
    Press F2
    Press Ctrl+Shift+Enter keys together.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    10-24-2015
    Location
    United States
    MS-Off Ver
    MS Office 2013
    Posts
    9

    Re: more exlusion or inclusion criteria for random match

    Quote Originally Posted by bebo021999 View Post
    Results for row 3 and row 4.
    For row 2, I afraid that I am not following your idea. Could you please give few desired outputs?
    Copy of dang xu ly.xlsx



    Once again, AMAZING! for row 2, the index is actually N2:N36
    outputs would be, this this case, anything in that index that does not contain text "appliance" and what you've made in row 4, I've put examples in the attached workbook. so, If appliance 2-2 is target, row 2 can be any cutlery_, and glass_, and any appliance_ except for appliance_2-1, 2-3, and 2-4
    Later I will have to do the same thing for, glass and cutlery,so I like your use of wildcards.
    Thank you once again for taking the time to help me, I cant express how greatfull I am.

  6. #6
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: more exlusion or inclusion criteria for random match

    Hi,
    Nice to hear it works for row 3 & 4
    This attachment is updated for row 2
    Hope it helps.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    10-24-2015
    Location
    United States
    MS-Off Ver
    MS Office 2013
    Posts
    9

    Re: more exlusion or inclusion criteria for random match

    Quote Originally Posted by bebo021999 View Post
    Results for row 3 and row 4.
    For row 2, I afraid that I am not following your idea. Could you please give few desired outputs?

    Little bit of tweaking and got everything working. Thanks again for taking time to help me out!

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: more exlusion or inclusion criteria for random match

    Quote Originally Posted by anxiolydiot View Post
    Little bit of tweaking and got everything working. Thanks again for taking time to help me out!
    Can you share it?

  9. #9
    Registered User
    Join Date
    10-24-2015
    Location
    United States
    MS-Off Ver
    MS Office 2013
    Posts
    9

    Re: more exlusion or inclusion criteria for random match

    Quote Originally Posted by bebo021999 View Post
    Hi,
    Nice to hear it works for row 3 & 4
    This attachment is updated for row 2
    Hope it helps.
    Oh, we were posting at the same time. I like your new solution better than mine!
    You are truly amazing!

  10. #10
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: more exlusion or inclusion criteria for random match

    Nice!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  11. #11
    Registered User
    Join Date
    10-24-2015
    Location
    United States
    MS-Off Ver
    MS Office 2013
    Posts
    9

    Re: more exlusion or inclusion criteria for random match

    Quote Originally Posted by bebo021999 View Post
    Can you share it?
    I think I wasn't clear when asking for what I needed in the row 2. I just needed to change the Index to encompass N2:N36. What you just submitted is very cool though defiantly will use it for something in the future. Sorry I'm not very savvy with formulas, this is actually for something that would typically be written in python but I wanted to see if I could get what I needed out of excel. Its pretty amazing at what you can do If you know how in Excel; I'm trying to learn more.
    I will also marked solved now

  12. #12
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,463

    Re: more exlusion or inclusion criteria for random match

    OK, to help you to expand it in future, I will go step by step:

    INDEX($N$2:$N$13,LARGE(IF((COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)=0,"",ROW(INDIRECT("1:"&ROWS($N$2:$N$13)))),RANDBETWEEN(1,COUNT(IF((COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)=0,"",ROW(INDIRECT("1:"&ROWS($N$2:$N$13))))))))

    Let start with case row 3, AS3 to AU3 must be same series as AR3.
    First, let fix AR3 with 1-2.png, AS3 with 1-4.png. Star working in AT3
    Initial though, using INDEX(N2:N13,n), with n is random choice from 1 to 12, but excluding: (A) 5 to 12 (Not appliance*) and (B) 2 and 4 (AR3 and AS3 wass previous chosen)
    So, try to create 2 arrays with (A) and (B) criteria, in which 1/0 displays true/false, then multiply them to give a new combi-array (array C with 1/0 follow the two criterias).
    1) Range A: COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0
    count each item with prefixed "appliance_1" of N2:N13 in AR3:AS3, if >0, read 1, else, read 0.
    In formula bar, evaluate range A by highlight it, hit F9:{TRUE;TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE}
    with 5-12 is excluded by FALSE.
    2) Range B: COUNTIF($AR$3:AS$3,$N$2:$N$13)=0
    reads each item in N2:N13 is 1 (if not found in AR3:AS3), is 0 if found.
    evaluate = {TRUE;FALSE;TRUE;FALSE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE;TRUE}
    you can see 2 and 4 is excluded by FALSE
    3) Range A * Range B = (COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)
    evaluate = {1;0;1;0;0;0;0;0;0;0;0;0}
    4) Inteprete 0 to blank, 1 to oder number: (=IF(A*B=0,"",{1 to 12})
    IF((COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)=0,"",ROW(INDIRECT("1:"&ROWS($N$2:$N$13))))
    (=IF(A*B=0,"",{1 to 12})
    evaluate = {1;"";3;"";"";"";"";"";"";"";"";""}
    Initia though, use LARGE(array, randbetween(1,2)), where 2 equals numbers counted in array.
    LARGE(IF((COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)=0,"",ROW(INDIRECT("1:"&ROWS($N$2:$N$13)))),RANDBETWEEN(1,COUNT(IF((COUNTIF($AR$3:AS$3,LEFT($N$2:$N$13,FIND("-",$AR3)-1)&"*")>0)*(COUNTIF($AR$3:AS$3,$N$2:$N$13)=0)=0,"",ROW(INDIRECT("1:"&ROWS($N$2:$N$13)))))))
    randomly read 1 or 3
    Finally, INDEX(N2:N13, LARGE(..) pick unique item randomly.
    Hope it is clear enough. Any raising question, do not hesitate to ask here.

+ 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. Return 3 values from column based on random value but with exlusion criteria
    By anxiolydiot in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-29-2015, 07:32 AM
  2. Replies: 16
    Last Post: 11-25-2014, 09:58 AM
  3. [SOLVED] Renumber rows with the inclusion of blank
    By fanx in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-01-2013, 12:49 PM
  4. Checking for inclusion in a new list
    By amartino44 in forum Excel General
    Replies: 1
    Last Post: 05-17-2013, 01:08 PM
  5. Replies: 1
    Last Post: 06-13-2011, 12:09 PM
  6. Vba Excel code for inclusion in existing vba project
    By John Bortoli in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-15-2010, 05:20 PM
  7. Replies: 2
    Last Post: 05-10-2006, 04:35 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