+ Reply to Thread
Results 1 to 14 of 14

Comparing Several Arrays with Offset

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Comparing Several Arrays with Offset

    Hi,

    I have attached a workbook with an example to explain more clearly.

    Basically I have 4 ranges each of 6 columns and all in 1 row (i.e. 24 consecutive columns).
    I would like to compare the 6 titles in range 1 to the titles in the other 3 ranges.

    For Range 1 versus 2 I used the formula =IF(0=SUM(IF(OFFSET(B7,0,0,1,6)=OFFSET(B7,0,6,1,6),0,1)),"OK","Check") which works fine.

    Similarly for range 1 versus 2 and then range 1 versus 3 i used =IF(0=SUM(IF(OFFSET(B7,0,0,1,6)=OFFSET(B7,0,12,1,6),0,1)),"OK","Check") and =IF(0=SUM(IF(OFFSET(B7,0,0,1,6)=OFFSET(B7,0,18,1,6),0,1)),"OK","Check") which also works fine.

    I then tried to compare range 1 versus range 2, range 3 and range 4 in one formula as follows, but this failed.
    =IF(0=SUM(IF(OFFSET(B7,0,0,1,6)=OFFSET(B7:G7,0,N(ROW(A1:A3)*6),1,6),0,1)),"OK","Check")

    Any help is much appreciated, thanks John
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,036

    Re: Comparing Several Arrays with Offset

    Administrative Note:

    Members will tailor the solutions they offer to the version (NOT release number) of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect - 8 is not a version of Excel. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Comparing Several Arrays with Offset

    For a start, I would NOT use OFFSET... it's volatile & best avoided:

    =IF(SUMPRODUCT(--($B$7:$G$7=H7:M7))>0,"OK","Check")

    and similar for the firrst 3 and for the last one:

    =IF(SUMPRODUCT(($B$7:$G$7=H7:M7)*(B7:G7=N7:S7)*(B7:G7=T7:Y7))>0,"OK","Check")
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Thanks Glenn.

    Yes I understand this is possible via sumproduct or array formulas.
    The example I used of 6 by 4 is for illlustration only, my data is actually significantly larger that.
    Am not a huge fan of sumproduct or array formulas.

    Any thoughts on why this formula fails....=IF(0=SUM(IF(OFFSET(B7,0,0,1,6)=OFFSET(B7:G7,0,N(ROW(A1:A3)*6),1,6),0,1)),"OK","Check")?

    Regards John

  5. #5
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Comparing Several Arrays with Offset

    Please try

    =IF(MMULT(--(B7:G7=INDEX(H7:Y7,SEQUENCE(3,6))),SEQUENCE(6))=21,"OK","Check")

    or with LAMBDA

    =BYROW(INDEX(H7:Y7,SEQUENCE(3,6)),LAMBDA(z,IF(AND(z=B7:G7),"OK","Check")))
    Attached Files Attached Files

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Comparing Several Arrays with Offset

    Why are you insistent on using a volatile function?

    SUMPRODUCT will work perfectly on much larger data ranges.

    What is the end result? a formula to compare block 1 to blocks 2,3,4,....50, or something like that??

  7. #7
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Hi Glenn,

    The end result is a formula in which there are R ranges each with width of C columns to compare to Range #1.
    I thought with the use of R and C as variables, within an offset formula would be the most suitable.
    Thanks John

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Comparing Several Arrays with Offset

    One formula, copied down, to compare each block of 6 with the first one:

    =IFERROR(IF(SUMPRODUCT(--($B$7:$G$7=INDEX($H$7:$Y$7,,1+6*(ROWS(B$9:B9)-1)):INDEX($H$7:$Y$7,,6+6*(ROWS(B$9:B9)-1))))>0,"OK","Check"),"")

    Adjust the bits in red to suit your last datapoint
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Thanks Glenn,

    Will review and try to understand your formula.

    Regards John

  10. #10
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Hi Bo Ry,

    Quite an innovative solution, thank you.
    I am not familiar with the functions you are using.
    Will study and revert.

    Regards John.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Comparing Several Arrays with Offset

    Welcome (back) to the forum.

    Thanks for your question. However, we have just found out that you have posted the same question elsewhere.... and haven't told us. Feel free to cross-post on other sites...

    But. Every forum has its rules. Please see Forum Rule #3 about cross-posting. So.

    Do not keep it a secret. We all are willing to give you our time, freely. However, some of us get very annoyed if we waste our time developing a solution for you, when you already have a nice solution elsewhere. All we ask is that you show us some respect and tell us:

    1) if you have cross-posted, and

    2) the URL of the cross posts.

    That way, those of us who don't want to waste their time can quickly check to see if you're already happy with another solution.

    It is especially annoying that you cross-posted long AFTER two solutions have been offered here and you have not commented on EITHER of them.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)
    Last edited by Glenn Kennedy; 03-08-2022 at 04:20 AM.

  12. #12
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Apologies Glenn, I forgot to mention that I cross posted.
    A similar post has been made at https://chandoo.org/forum/threads/co...4/#post-282500
    Thanks for reminding me of the forum rules.
    Regards john

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Comparing Several Arrays with Offset

    Noted. However, you have still not responded regarding the suitability of either of the solutions offered (posts 7 and 9), despite being reminded by me to do so.

  14. #14
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Hong Kong
    MS-Off Ver
    Office 365 PC Version
    Posts
    216

    Re: Comparing Several Arrays with Offset

    Hi Glenn,

    I reviewed the 2 solutions posted.
    These solutions work, however, they are beyond my level of excel capabilities and understanding.
    I have reverted to simple formulas in multiple columns and rows for my solution.
    Not at all as elegant as the solutions provided here, but simple to understand.
    Thank you very much for all the efforts and kindest regards.

+ 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. Comparing arrays
    By batchjb69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2017, 09:21 PM
  2. Comparing 2 Arrays
    By kchm2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-25-2017, 05:26 AM
  3. Help comparing 2 arrays
    By jfoerch in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2015, 12:14 PM
  4. [SOLVED] Help Comparing Arrays (to Other Arrays)
    By Polite Master in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-20-2013, 01:03 PM
  5. Comparing arrays....
    By Bedlam in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 11-02-2011, 03:15 PM
  6. Comparing arrays
    By JoshuaSQ in forum Excel General
    Replies: 8
    Last Post: 02-13-2010, 01:47 AM
  7. 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