+ Reply to Thread
Results 1 to 7 of 7

How to compile data from multiple sheets and then test that against another sheet

Hybrid View

  1. #1
    Registered User
    Join Date
    06-15-2019
    Location
    Washington, DC
    MS-Off Ver
    Excel for 365 (Version 1902)
    Posts
    20

    How to compile data from multiple sheets and then test that against another sheet

    [Previously titled, "How to create something like:COUNTIF(A1:J10, AND(OR(Sheet1!A1=1, Sheet2!A1=1), Sheet3!=1))"]

    Sorry, that title [is probably] was terrible, but I'm having trouble describing what I need to do, and that imaginary function is pretty close.

    I have many sheets of binary data, and several sheet of "designed" data (also binary), all of which are the same range. I need to test how well different combinations of the data sheets match the designed data.

    I can do this for any single test with a helper sheet. On the helper sheet, I create an IF statement in each cell in the range that uses an OR to check if any of the data sheets have a 1, and then uses AND to check that against the designed sheet. E.g., =IF(AND(OR(Sheet1!A1=1, Sheet2!A1=1, Sheet3!A1=1), Design!A1=1), 1, 0). And then since I know how many positive cells a sheet should contain (all the designed sheets have the same number of positive cells), I just sum the helper sheet.

    The attached example workbook shows what I'm trying to accomplish for a single case, using the method I described.

    The problem is that I need a way to do it at scale, since I have a few dozen data sheets that need to be tested in different combinations and a handful of designed sheets. So the total workload here is possibly a couple thousand iterations of this. The only information I need for each iteration is the sum on the helper sheet (I don't need to know which cells in each test fail to match).

    Any help is greatly appreciated. I can work with VB code if that's the best way to do this. Thank you for any ideas!
    Attached Files Attached Files
    Last edited by Dimensional; 10-31-2019 at 01:09 PM. Reason: Bad title

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

    Re: How to create something like:COUNTIF(A1:J10, AND(OR(Sheet1!A1=1, Sheet2!A1=1), Sheet3!

    Administrative Note:

    Yes, the title is terrible - sorry.

    We would very much like to help you with your query, however the thread title does not really convey what your request is about.

    Please take a moment to amend your thread title. Make sure that the title properly explains your request. Your title should be explicit and not be generic (this includes function names used without an indication of what you are trying to achieve).

    Please see Forum Rule #1 about proper thread titles and adjust accordingly. To edit the thread title, open the original post to edit and then click on Go Advanced (bottom right) to access the area where you can edit your title.

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    06-15-2019
    Location
    Washington, DC
    MS-Off Ver
    Excel for 365 (Version 1902)
    Posts
    20

    Re: How to create something like:COUNTIF(A1:J10, AND(OR(Sheet1!A1=1, Sheet2!A1=1), Sheet3!

    Sorry about that, post has been re-titled.
    Last edited by Dimensional; 10-31-2019 at 01:19 PM.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,790

    Re: How to compile data from multiple sheets and then test that against another sheet

    Thank you.

  5. #5
    Registered User
    Join Date
    06-15-2019
    Location
    Washington, DC
    MS-Off Ver
    Excel for 365 (Version 1902)
    Posts
    20

    Re: How to compile data from multiple sheets and then test that against another sheet

    It looks like the following code does the AND portion of what I'm trying to do.

    =SUMPRODUCT((Sheet3!A1:J10=1)*(Design!A1:J10=1))

  6. #6
    Registered User
    Join Date
    06-15-2019
    Location
    Washington, DC
    MS-Off Ver
    Excel for 365 (Version 1902)
    Posts
    20

    Re: How to compile data from multiple sheets and then test that against another sheet

    Further update. I have discovered that
    =SUMPRODUCT((Sheet1!A1:J10=0)*(Sheet2!A1:J10=0)*(Sheet3!A1:J10=0))
    gets me the inverse of what I need. So in the example sheet attached, that tells me that there in sheets 1-3, there are 6 cells where all three sheets are 0. I need to find a way to turn that inside out so that it's producing 94...

  7. #7
    Registered User
    Join Date
    06-15-2019
    Location
    Washington, DC
    MS-Off Ver
    Excel for 365 (Version 1902)
    Posts
    20

    [SOLVED] How to compile data from multiple sheets and then test that against another sheet

    Okay, I figured out something that works.

    =SUMPRODUCT((Design!A1:J10=1)*(Sheet1!A1:J10=0)*(Sheet2!A1:J10=0)*(Sheet3!A1:J10=0))
    That returns the number of "gaps" in the real data--i.e., places where the designed data is 1 but all the data sheets being tested are 0. So I can set up all the possibilities and use INDIRECT to run the test.

+ 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. Replies: 8
    Last Post: 12-22-2013, 01:16 PM
  2. [SOLVED] Data auto fill from sheet2 and sheet3 to sheet1
    By Nikesh_2515 in forum Excel General
    Replies: 18
    Last Post: 03-21-2013, 11:46 PM
  3. [SOLVED] A1, Sheet1 minus A1, Sheet2. Result in A1, Sheet3.
    By nkormanik in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-27-2013, 07:18 PM
  4. Macro keeps looking for sheet1, won't use sheet2, sheet3 . . .
    By salvator in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2011, 10:12 PM
  5. Excel 2007 : Compare: Sheet1 - Sheet2 into Sheet3
    By vbjohn in forum Excel General
    Replies: 3
    Last Post: 07-17-2009, 03:33 PM
  6. How to copy some columns from sheet1 to sheet2 or sheet3
    By wlarson in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-30-2007, 08:58 AM
  7. Transfer data from sheet1 to sheet2 and sheet3
    By vbosmiya in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-21-2007, 11:42 PM
  8. A1 in sheet1 =” =SUM('sheet2:sheet3'!A1)”
    By minrufeng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2006, 03:10 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