+ Reply to Thread
Results 1 to 13 of 13

Exclude certain rows from the table array in the VLOOKUP

  1. #1
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Exclude certain rows from the table array in the VLOOKUP

    Hello,

    I need to exclude certain rows from the table array in the VLOOKUP formula exactly the two rows under the LOOKUP value, this formula is a part of big formula so i cannot use macro to solve it.
    I need to tell as following:

    VLOOKUP(M9,M:N-(M9:N11),2)

    any other tip.
    Attached Files Attached Files
    Last edited by Mhabashy; 10-18-2022 at 05:39 AM. Reason: Attachment Added

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Exclude certain rows from the table array in the VLOOKUP

    Instead of using full-column references for the table, you could use this:

    =VLOOKUP(M9,M$12:N$5000,2)

    (you can change the 5000 if you have more data).

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Re: Exclude certain rows from the table array in the VLOOKUP

    thanks Pete_UK for your reply but the problem i need the formula to search above and under M9 except the M9,M10,M11
    and its variable when the LOOKUP value is M40 so i need the search to be above and under except M40,M41,M42.
    Last edited by Mhabashy; 10-18-2022 at 04:43 AM.

  4. #4
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,786

    Re: Exclude certain rows from the table array in the VLOOKUP

    There are instructions at the top of the page explaining how to attach your sample workbook. Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.

    Administrative Note:

    Is you forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. 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.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    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.

  5. #5
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Re: Exclude certain rows from the table array in the VLOOKUP

    Thanks AliGW for your kind reply
    I already edit my post with sample attachment and updated my profile.

    thanks.

  6. #6
    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. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,786

    Re: Exclude certain rows from the table array in the VLOOKUP

    Explain the logic behind the answers you are expecting. What's the thought process?

  7. #7
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Exclude certain rows from the table array in the VLOOKUP

    I've try this formula

    =IF(COUNTIF(M$7:M7,M7)=1,LOOKUP(2,(1/($M$7:$M$27=M7)),$N$7:$N$27),VLOOKUP(M7,$M$7:$N$27,2,FALSE))

    but not sure about the result

    Regards.
    Attached Images Attached Images

  8. #8
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Re: Exclude certain rows from the table array in the VLOOKUP

    Thanks menem very much
    its working, i will trying to add it to my big formula the problem its very complicated now

    the problem is its mentioned specific range till row 27 put the actual table is very long and variable

    i will wait for this night maybe i can get shorter and more flexible formula or i will highlight it as Solved.

    thanks again,
    Last edited by Mhabashy; 10-18-2022 at 07:16 AM.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Exclude certain rows from the table array in the VLOOKUP

    From Menem's picture, it looks like you want the maximum of column N for a given letter in column A. You might be able to use a MAXIFS function (not sure if it is available in XL2016), or an array formula based on MAX(IF...

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Re: Exclude certain rows from the table array in the VLOOKUP

    Thanks Pete i will try your suggestion, i tried to find any way to exclude some rows from the VLOOKUP table array formula but i think no way like that
    thanks for your help

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Exclude certain rows from the table array in the VLOOKUP

    If you do have the MAXIFS function available in your version of Excel, then you can use this formula in cell O7:

    =IF(MOD(ROW(),3)=1,MAXIFS($N$7:$N$27,$M$7:$M$27,M7),"")

    and if so, please update your profile to show the version you are currently using. If not, then you can use this array* formula instead:

    =IF(MOD(ROW(),3)=1,MAX(IF($M$7:$M$27=M7,$N$7:$N$27)),"")

    *Note that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual Enter.

    Copy the formula down as required (into every cell, no need to just paste it into every 3 cells).

    I'm not sure why your isolated cells for A and C should have the values that you state - please explain the logic for these.

    Hope this helps.

    Pete

  12. #12
    Registered User
    Join Date
    06-28-2022
    Location
    KSA
    MS-Off Ver
    Microsoft Office Professional Plus 2019
    Posts
    54

    Re: Exclude certain rows from the table array in the VLOOKUP

    Thank you MR, Pete
    i am really appreciating your efforts.
    the excel i mentioned is only as example because the original is big with complicated formulas and the one i am asking about is a part of long formula, and actually i am always need this type of formula to exclude range from the searching area i will try to understand your formula maybe i can use it in the future.
    i am grateful to your help, thanks alot,

    Maney

  13. #13
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Exclude certain rows from the table array in the VLOOKUP

    You're welcome - thanks for the rep.

    Pete

+ 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] Exclude Blank Rows With Array
    By billgyrotech in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-15-2016, 11:25 AM
  2. [SOLVED] table(A) as an array using all rows but only selected columns to compare with table(B)
    By se3unlock in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-27-2015, 10:15 AM
  3. Add EXCLUDE Option in table to Exclude from Solver
    By lbofbb in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-17-2015, 09:05 AM
  4. Create an array based off values in another array - exclude blanks
    By clifton1230 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-05-2013, 05:35 PM
  5. [SOLVED] vlookup to exclude rows when a cell is 0?
    By mattc_uk in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 09-11-2012, 10:59 AM
  6. Replies: 2
    Last Post: 02-23-2011, 07:24 AM
  7. VLOOKUP - 3 Table Array
    By tangomj in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-01-2006, 12:50 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