+ Reply to Thread
Results 1 to 14 of 14

A formula that looks at another table and returns all rows with a certain value

  1. #1
    Registered User
    Join Date
    04-25-2015
    Location
    Ontario, Canada
    MS-Off Ver
    2016
    Posts
    72

    A formula that looks at another table and returns all rows with a certain value

    In the attached workbook, I would like to have a tab where I find errors using a True/False table (A5:B7), then I show only the rows with "TRUE" on the Error Log tab.

    This is essentially replacing someone from having to go in and refilter each time. As soon as they fix the error, it should be removed from the Error Log listing.

    I know I did something like this with an array but I can't remember how.

    Thanks!
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    try this ARRAY formula...
    A2=IFERROR(INDEX(Data!B:B,SMALL(IF(Data!$A$6:$A$7=TRUE,ROW(Data!$A$6:$A$7)),ROWS($A$1:A1))),"")
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Then copy down as needed.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: A formula that looks at another table and returns all rows with a certain value

    Hi, you can copy this down in your sheet "Error Log":
    Please Login or Register  to view this content.
    This is not an array function!
    Cheers
    Erwin
    Last edited by Eastw00d; 05-27-2020 at 12:37 AM. Reason: additional information
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    Quote Originally Posted by Eastw00d View Post
    Hi, you can copy this down in your sheet "Error Log":
    Please Login or Register  to view this content.
    This is not an array function!
    Cheers
    Erwin
    Actually, it is an array function, but because you are ysung AGGREGATE, you just dont need to use CSE to enter

  5. #5
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: A formula that looks at another table and returns all rows with a certain value

    Thank you for pointing this out, you are right; I will put that differently in the future

    Cheers
    Erwin

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    No problem

    If you look at how I structured my INDEX, you will see I used full column ref. doing it that way does away with the need to subtract rows from the ROW() function...
    -ROW(Data!$A$6)+1

  7. #7
    Registered User
    Join Date
    04-25-2015
    Location
    Ontario, Canada
    MS-Off Ver
    2016
    Posts
    72

    Re: A formula that looks at another table and returns all rows with a certain value

    Quote Originally Posted by FDibbins View Post
    try this ARRAY formula...
    A2=IFERROR(INDEX(Data!B:B,SMALL(IF(Data!$A$6:$A$7=TRUE,ROW(Data!$A$6:$A$7)),ROWS($A$1:A1))),"")
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Then copy down as needed.
    Thanks, I think that's similar to the original formula I use way back when...although I forget how it works, but it works

    Quote Originally Posted by Eastw00d View Post
    Hi, you can copy this down in your sheet "Error Log":
    Please Login or Register  to view this content.
    This is not an array function!
    Cheers
    Erwin
    Thanks. However, when I use it, it seems to be returning the TRUE cell.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    Quote Originally Posted by dbl_dbl View Post
    Thanks. However, when I use it, it seems to be returning the TRUE cell.
    I think you need to adjust the 1st reference...
    INDEX(Data!$A$6:$A$7
    to col B instead...
    INDEX(Data!$b$6:$b$7

  9. #9
    Registered User
    Join Date
    04-25-2015
    Location
    Ontario, Canada
    MS-Off Ver
    2016
    Posts
    72

    Re: A formula that looks at another table and returns all rows with a certain value

    Quote Originally Posted by FDibbins View Post
    try this ARRAY formula...
    A2=IFERROR(INDEX(Data!B:B,SMALL(IF(Data!$A$6:$A$7=TRUE,ROW(Data!$A$6:$A$7)),ROWS($A$1:A1))),"")
    **Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Then copy down as needed.
    Ford - quick question. When I applied the formula to my sheet, I made it reference a table. It worked well, except it seems to be ignoring the first row (after the headers). Any ideas?

  10. #10
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    Did you adjust the range to include that 1st row?

  11. #11
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: A formula that looks at another table and returns all rows with a certain value

    Hi, I was merely doing what was asked:
    < "TRUE" errors should show up here.
    If you change the formula into:
    Please Login or Register  to view this content.
    you will have the "B"-column as answer.
    Cheers
    Erwin

  12. #12
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    Quote Originally Posted by Eastw00d View Post
    Hi, I was merely doing what was asked:
    If you change the formula into:
    Please Login or Register  to view this content.
    you will have the "B"-column as answer.
    Cheers
    Erwin
    Another suggestion for you - if you just use col B, instead of A:B, you wont need to add the ,2 at the end
    =IFERROR(INDEX(Data!$b$6:$B$7,AGGREGATE(15,6,ROW(Data!$A$6:$A$7)-ROW(Data!$A$6)+1/(Data!$A$6:$A$7=TRUE),ROWS('Error Log'!$A$2:A2))),"")

  13. #13
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,935

    Re: A formula that looks at another table and returns all rows with a certain value

    And thank you both for the feedback, too - always appreciated

  14. #14
    Registered User
    Join Date
    04-25-2015
    Location
    Ontario, Canada
    MS-Off Ver
    2016
    Posts
    72

    Re: A formula that looks at another table and returns all rows with a certain value

    Great solutions! Thanks everyone.

+ 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. One Formula Returns Multiple Rows
    By JohnnyVanns in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-13-2020, 02:15 PM
  2. [SOLVED] Looking for formula that returns values from column if the rows in table have text in them
    By CustomizablePlayer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-17-2020, 11:21 AM
  3. Replies: 1
    Last Post: 09-26-2019, 10:52 PM
  4. [SOLVED] Close up empty rows after IF formula returns 'true' results
    By Cupsay in forum Excel General
    Replies: 12
    Last Post: 03-04-2016, 11:32 PM
  5. Pivot table picks up empty cell from formula which returns BLANK
    By donyc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2013, 08:37 PM
  6. Auto unhide rows if formula returns a value >0
    By Jauharra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2013, 03:43 PM
  7. formula cell reference updates when query returns more rows
    By reillyBoston in forum Excel General
    Replies: 3
    Last Post: 08-18-2009, 11:20 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