+ Reply to Thread
Results 1 to 8 of 8

How can i retrieve a cell value based on two arrays

  1. #1
    Registered User
    Join Date
    10-16-2016
    Location
    Dubai
    MS-Off Ver
    Office 2013
    Posts
    1

    Post How can i retrieve a cell value based on two arrays

    Hi All,
    I'm not an expert in Excel, and I've been trying to learn how to retrieve the green cell value with a formula.

    So basically a formula that says the following: ( please refer to the attached Table)

    Tableeeeee.png
    1) Look for [F2] which is Brand 2
    2) Look for the closest or nearest number to [F3] which is 15
    3) Retrieve the cross matching exact value which is 5.

    I've managed to use a formula to retrieve exact match (if I write 18.9 in [F3] I get the green cell, but if I put a number that is not in column A, the formula gives an N/A)

    Would appreciate your help.

    Image
    Thanks,
    Maghraby

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

    Re: How can i retrieve a cell value based on two arrays

    Nearest -or nearest value greater than??

    If value is 8

    and choices are 7 and 9: which should be chosen?
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,178

    Re: How can i retrieve a cell value based on two arrays

    Do want to lookup the table value which has minimum difference for your search value i.e (18.9 -15) < (15-6.8 )?

    Using

    =INDEX($B$2:$D$4,MATCH($F$3,$A2:$A4,1),MATCH($F$2,$B$1:D$1,0))

    will return 2 as MATCH (with data in ascending sequence) finds the largest <= search value i.e 6.8

  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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: How can i retrieve a cell value based on two arrays

    Try this:

    =INDEX($B$2:$D$4,MATCH(F3,$A$2:$A$4,1)+1,MATCH(F2,$B$1:$D$1,0))
    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.

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

    Re: How can i retrieve a cell value based on two arrays

    Ali, that breaks if the entered value = any of the values in the array. If the OP MEANS nearest larger value, the best way may be to rearrange the table in descending order...

  6. #6
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: How can i retrieve a cell value based on two arrays

    Quote Originally Posted by Glenn Kennedy View Post
    Ali, that breaks if the entered value = any of the values in the array. If the OP MEANS nearest larger value, the best way may be to rearrange the table in descending order...
    True! And, yes - rearranging the data would help.

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

    Re: How can i retrieve a cell value based on two arrays

    Alternatively, this returns the matching/next largest matching value, with the table as it stands...

    =INDEX($B$2:$D$4,MATCH(SMALL($A$2:$A$4,COUNTIF($A$2:$A$4,"<"&$F$3)+1),$A$2:$A$4),MATCH($F$2,$B$1:$D$1,0))
    Attached Files Attached Files

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: How can i retrieve a cell value based on two arrays

    Many members are unable to see images in the *.png format due to forum compatibility issues with some browsers.

    If you need to post an image post it in the *.jpg format.

    Even better than posting images... post a SMALL sample file. That way we can test solutions directly in the file with the relevant data.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

+ 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. Use VLOOKUP to retrieve a value based on a word within a cell
    By Nelzon in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-09-2016, 08:11 PM
  2. [SOLVED] Retrieve Data From Cell Based in Array Based on LARGE Function
    By justarandomguy in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-13-2014, 02:31 AM
  3. Retrieve multiple cell references based on a criteria
    By Danut Alexandru in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-04-2014, 02:16 PM
  4. [SOLVED] Retrieve data from a cell based on date criteria in another
    By ajob in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-23-2014, 08:49 AM
  5. Retrieve values from table based on lookup of another cell
    By StarHunter in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-07-2012, 05:25 PM
  6. [SOLVED] Retrieve value based on the value of another cell (Lookup)
    By ACDC in forum Excel General
    Replies: 12
    Last Post: 03-27-2012, 05:45 PM
  7. Replies: 7
    Last Post: 03-26-2009, 12:13 PM

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