+ Reply to Thread
Results 1 to 9 of 9

Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

  1. #1
    Registered User
    Join Date
    06-01-2016
    Location
    Detroit, MI
    MS-Off Ver
    2016
    Posts
    14

    Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    Hello,

    I am working on a spreadsheet that has a formula in that I'm not quite following the logic. I understand to a point, but not enough to explain it to someone else (which I have to do). It works perfectly, but I'm wondering if there is an easier way to accomplish the same thing. Here is the formula as of now:

    =IF($F3<>"",LOOKUP($F3,$AW$25:$AW$33,CHOOSE(MATCH($H3,{"M";"F"},0),$AX$25:$AX$33,$AY$25:$AY$33)),"")

    It is looking up the ages (column F) of each person and referring to an RDI (recommended daily intake) table ($AW$25:$AW$33), and returning the correct RDI for each person depending on whether they are male ("M") or female ("F"). The values for male are found in columns $AX$25:$AX$33 and the values for females are found in columns $AY$25:$AY$33.

    Thank you! I know this is a bit of a messy one.

  2. #2
    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,147

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    A variant ..

    =VLOOKUP($F3,$AW$23:$AY$27,IF($H3="M",2,3),1)

    Corrected as pointed out by Jonmo1
    Last edited by JohnTopley; 06-30-2016 at 02:52 PM.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    To use the vlookup, you'd have to use 1 as the 4th argument (or leave it out), since the original formula is a LOOKUP, it does the 'closest match' type.

  4. #4
    Registered User
    Join Date
    06-01-2016
    Location
    Detroit, MI
    MS-Off Ver
    2016
    Posts
    14

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    Thanks a lot for the response, John. A short formula like that would be great. However, it didn't seem to work. I'm thinking that maybe it is because the age isn't an exact match (the values fall between a range of ages):

    Captura de pantalla 2016-06-30 a las 2.55.45 PM.png

    Any further insight would be greatly appreciated.

  5. #5
    Registered User
    Join Date
    06-01-2016
    Location
    Detroit, MI
    MS-Off Ver
    2016
    Posts
    14

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    Thanks for the response, Jonmo1. That didn't seem to work either. I think it may be because of the issue I posted above. I appreciate your help.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    If this formula works
    =IF($F3<>"",LOOKUP($F3,$AW$25:$AW$33,CHOOSE(MATCH($H3,{"M";"F"},0),$AX$25:$AX$33,$AY$25:$AY$33)),"")

    Then this formula would work as well (I added the If F3<>"" part, and the row #s were different in John's post compared to the original.
    =IF($F3<>"",VLOOKUP($F3,$AW$25:$AY$33,IF($H3="M",2,3),1),"")

  7. #7
    Registered User
    Join Date
    06-01-2016
    Location
    Detroit, MI
    MS-Off Ver
    2016
    Posts
    14

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    Jonmo1... That worked! Thanks a lot for your time.

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    You're welcome.

  9. #9
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,841

    Re: Confusing nested function (IF, LOOKUP, CHOOSE, MATCH)

    Using named ranges and INDIRECT makes the formula less complex.

    Edit: I take that back, Jonmo's last one is pretty slick.
    Last edited by Jacc; 06-30-2016 at 03:49 PM.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

+ 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] Nested If, Lookup, Match - Not sure what to use to compare two values
    By bigbavarian in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 06-04-2013, 10:32 AM
  2. Need help combining an IF statement and lookup, choose, or match functions
    By sixsteps268 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-20-2013, 03:28 PM
  3. [SOLVED] Nested Lookup or Index,Match or ??
    By rwabennett in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-27-2013, 10:42 AM
  4. Very confusing formula with INDEX & MATCH
    By brooksc29 in forum Excel General
    Replies: 6
    Last Post: 01-28-2011, 08:00 PM
  5. Dependent Percentile Formula in Table with Nested Lookup or Index Match?
    By chogan in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-11-2010, 06:34 PM
  6. [SOLVED] Offset function with nested match function not finding host ss.
    By MKunert in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-21-2006, 06:50 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