+ Reply to Thread
Results 1 to 7 of 7

Help Comparing Arrays (to Other Arrays)

  1. #1
    Registered User
    Join Date
    09-17-2013
    Location
    -
    MS-Off Ver
    -
    Posts
    6

    Help Comparing Arrays (to Other Arrays)

    Hi Excel Forum,

    Cross-post here: http://www.mrexcel.com/forum/excel-q...er-arrays.html

    Here is an illustation of my real data:
    {1 1 1 1}
    {1 9 1 1}
    {1 1 9 9}

    Here is the problem:
    All values in {1,1,1,1} are < or = to all corresponding values in at least one other row in this example (both the second and third rows). In other words, {1,1,1,1} is obsolete because there is at least one other row that meets or exceeds all corresponding values. On the contrary, neither {1,9,1,1} nor {1,1,9,9} are obsolete; no row, excluding themselves, can utterly beat {1,9,1,1} nor {1,1,9,9} in a one-on-one fight.

    We need to compare each row to every other row in our big data. In the process, the obsolete rows are marked. The end result may be condition formatting to the data or a separate column of Y's/N's, TRUE's/FALSE's, etc. (denoting obsolete).

    Here is what I tried:
    =--(F17:L17<=F18:L18)={1,1,1,1,1,1,1} We compare a row in question (F17:L17) to one other row (F18:L18) by <=. Formula produces an array of TRUE's and FALSE's, and the "--" converts that to an array of 1's and 0's. Result after CTRL+SHIFT+Enter is a single cell with TRUE (expected). The main disadvantage of this method is we would end up with large tables and a lot of manual work. We are are not sure our method works and would like something cleaner. Also note we want to exclude comparing a given row with itself.




    This is my first post on the forum. I am not an expert at Excel (little experience with formulas, macros, or scripting), so feel free to elaborate. Thank you in advance!

    - Polite Master
    Last edited by Polite Master; 09-20-2013 at 12:44 PM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Help Comparing Arrays (to Other Arrays)

    welcome to the forum. not sure if i got your question right. you also explained your real data in 4 columns while your formula eg shows F17:L17 (7 columns). i'm just going to assume data in F17:I19 like the way you illustrated your data in 4 columns & 3 rows. then try this in say J17:
    =SUMPRODUCT(--(F17:I17<=$F$17:$I$19))=COUNT($F$17:$I$19)

    it will turn up as TRUE because all other rows of the same column have values <= to it. copy down & the other 2 rows will turn up as FALSE. if i got it wrong, here's how i normally recommend people ask their questions:
    http://www.excelforum.com/tips-and-t...d-answers.html

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Registered User
    Join Date
    09-17-2013
    Location
    -
    MS-Off Ver
    -
    Posts
    6

    Re: Help Comparing Arrays (to Other Arrays)

    Quote Originally Posted by benishiryo View Post
    welcome to the forum. not sure if i got your question right. you also explained your real data in 4 columns while your formula eg shows F17:L17 (7 columns). i'm just going to assume data in F17:I19 like the way you illustrated your data in 4 columns & 3 rows. then try this in say J17:
    =SUMPRODUCT(--(F17:I17<=$F$17:$I$19))=COUNT($F$17:$I$19)

    it will turn up as TRUE because all other rows of the same column have values <= to it. copy down & the other 2 rows will turn up as FALSE. if i got it wrong, here's how i normally recommend people ask their questions:
    http://www.excelforum.com/tips-and-t...d-answers.html
    Hi Benishiryo,

    Thank you for the welcome . I appreciate the link and will update my post with real data (correctly counted as 7 columns). I am working out your formula. If I understand correctly, the =COUNT (right side) will be 12 in my first example (12 cells). The SUMPRODUCT part (left side) will be a value between 4 and 12 depending how the values in F17:I17 compare with the other two rows. If I am thinking correctly , I am not sure this alone is the solution. If just one value in F17:I17 is < or = a corresponding value in another row one or more times, then it will be marked as good (or not obsolete). It should only be considered good if it cannot be beaten by a whole row.

    Allow me some time to upload the data to my post. Then it may be clearer for us.


    Thank you again.

  4. #4
    Registered User
    Join Date
    09-17-2013
    Location
    -
    MS-Off Ver
    -
    Posts
    6

    Re: Help Comparing Arrays (to Other Arrays)

    Okay, here is the attached workbook

    P.S. The cell references above do not correspond with uploaded data, which now starts at A2.
    Reuploaded 2x for typos.
    Attached Files Attached Files
    Last edited by Polite Master; 09-18-2013 at 12:37 AM.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Help Comparing Arrays (to Other Arrays)

    still not sure if i understood correctly. try this in I2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    if i got it wrong, tell me the row & why it's wrong

  6. #6
    Registered User
    Join Date
    09-17-2013
    Location
    -
    MS-Off Ver
    -
    Posts
    6

    Re: Help Comparing Arrays (to Other Arrays)

    WOW! I think you got it right! The COUNTIFS formula seems like the appropriate solution.

    I will continue to look over the results with the large data. So far, it looks good.

    I don't fully understand the syntax of your formula. Could you briefly explain why there are quotes around >=, and the role of the &.



    Thank you so much for assistance, Benishiryo. I am absolutely beaming!

    - Polite Master

  7. #7
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Help Comparing Arrays (to Other Arrays)

    glad to help. =)

    COUNTIF can be used with different operators like:
    = equals
    > greater than
    >= greater than or equals to
    etc...
    by not putting any operators, the default is "equals". so if i wanna count how many times "10" appears in A1:A10, it'll be:
    =COUNTIF(A1:A10,"10")
    you can also put it as:
    =COUNTIF(A1:A10,"=10")
    *for numbers, it can be without the double quotes. but i just needed to illustrated the it for the next part
    =COUNTIF(A1:A10,10)

    to count how many cells are greater or equals to 10, you need to put in:
    =COUNTIF(A1:A10,">=10")

    if 10 is in a separate cell in say C1, then you have to combine the operator with the cell reference. so:
    =COUNTIF(A1:A10,">="&C1)

    so basically in your case of row 2, i need to count how many cells in $A$2:$A$72 is greater than or equals to A2, AND how many in $B$2:$B$72 is greater than or equals to B2, etc...

    at least 1 row will be, because row 2 itself will be equals to row 2. so only when the count is equals to 1, it's obsolete. hope that helps

+ 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] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  2. Comparing arrays....
    By Bedlam in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 11-02-2011, 03:15 PM
  3. Comparing arrays
    By JoshuaSQ in forum Excel General
    Replies: 8
    Last Post: 02-13-2010, 01:47 AM
  4. Arrays - declaration, adding values to arrays and calculation
    By Maxi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2006, 11:15 AM
  5. Comparing Arrays
    By TangentMemory in forum Excel General
    Replies: 2
    Last Post: 05-13-2005, 01:06 PM

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