+ Reply to Thread
Results 1 to 30 of 30

Using IF & Lookup Function

  1. #1
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Using IF & Lookup Function

    Hi,

    I had some help last week to solve this function which I was most appreciated with, however, I've realised that I need a bit more detail.

    Basically I was trying to get an outcome/level to correspond to a score in a test so I could triangulate data sets.

    With my new example, I've added in an O3 for the criteria box also, which means D18 doesn't show correctly.

    I also can't get the formula to work for the bottom, even with the old criteria.

    I have attached the spreadsheet along with the answers I would expect.
    O2c, O2b, O2a = O2 (Outcome_ etc. whilst 5a, 5b, 5c, = L5 (Level) and so on

    Any help appreciated as always
    Thanks
    Attached Files Attached Files

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

    Re: Using IF & Lookup Function

    This cannot work as a lookup:

    Excel 2016 (Windows) 32 bit
    P
    Q
    2
    New Criteria
    3
    0
    O3/O4
    4
    85
    O5
    5
    125
    O6
    Sheet: Comparative Report

    The top row, where you have O3/O4, needs redefining, as it will not work with the formula here:

    =IF(D12="Y","Y",IF(LOOKUP(E12,$P$3:$P$5,$Q$3:$Q$5)=LEFT(B12,2),"Y","N"))

    Each O value needs defining separately.
    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
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi Ali,

    Thanks for the reply, that makes sense. I have now redefined the criteria. Could you possibly help now?

    Many thanks
    Attached Files Attached Files

  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,728

    Re: Using IF & Lookup Function

    What do you want help with?

  5. #5
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,
    Disregarding my previous request, I would like the If Lookup formula to work on the bottom section of my excel sheet also please.
    Thank you

  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,728

    Re: Using IF & Lookup Function

    Where do I start?

    =IF(LOOKUP(C4,$P$21:$P$25,$Q$21:$Q$25)=LEFT(B4,2),"Y","N")

    Should, I think, be this:

    =IF(LOOKUP(C22,$P$21:$P$25,$Q$21:$Q$25)=LEFT(B22,2),"Y","N")

    HOWEVER the data in the lookup table doesn't match what is in column B ...

  7. #7
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi Ali,
    Thanks for the reply again. Yes I see that L4 doesn't appear in text, is there a way of L4 being recognised as 4a, 4b, 4c?

    If not, would it be worth ammending the criteria table to have Level above the right hand column?
    Please advise accordingly
    Last edited by AliGW; 01-07-2019 at 11:09 AM.

  8. #8
    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,728

    Re: Using IF & Lookup Function

    Are these old NC levels? I'm a teacher, too.

    If you are using lookup tables, the lookup values have to match what is being looked up - it's as simple as that. You could have an intermediate lookup - a lookup that converts a value so that it can be looked up against something else - but it gets messy and hard to maintain.

    You probably need to explain again in WORDS what exactly you are trying to achieve. Talk me through what you want one formula (the one in row 22) to do.

    Please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.

  9. #9
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi Ali,

    I'm glad you sympathise with a fellow teacher!

    Much like in the top half of my table I've managed to get the 'Match' column to see whether the test score matches the outcome, I want the same to happen for the Level & test scores in the bottom section.

    On the top table it has recognised O5 as O5c, O5b, and O5a. I want the same for the bottom table, therefore it to recognise a 'level' 5 as 5a, 5b, or 5c, using the lookup table.

    The second 'match' column looks up the new results, therefore 'triangulating' the data. However a Y in the first match section would supersede any result in the second set of test results.
    I hope that makes sense?

    I have reattached the excel sheet which should hopefully make it more clear in regards to the criteria table.

    Thanks once again
    Attached Files Attached Files

  10. #10
    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,728

    Re: Using IF & Lookup Function

    But you still aren't referencing the correct cells, are you? Surely this in D22:

    =IF(LOOKUP(C4,$P$21:$P$25,$Q$21:$Q$25)=LEFT(B4,2),"Y","N")

    should be this:

    =IF(LOOKUP(C22,$P$21:$P$25,$Q$21:$Q$25)=LEFT(B22,1),"Y","N")

    That aside, try this:

    =IF(VLOOKUP(C22,$P$21:$Q$25,2,1)=--LEFT(B22,1),"Y","N")

    Drag copy down.
    Last edited by AliGW; 01-07-2019 at 11:29 AM.

  11. #11
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,

    Thanks for the reply. The VLookup for column D worked perfectly, brilliant!

    Could you please advise on column G. For this to work it needs to look at column E & F (it may help looking at the top half and how this worked?)
    I can't seem to get my head around it unfortunately.

    Thanks

  12. #12
    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,728

    Re: Using IF & Lookup Function

    How about this:

    =IF(D22="Y","Y",IF(VLOOKUP(E22,$P$21:$Q$25,2,1)=--LEFT(B22,1),"Y","N"))

    Drag copy down.

  13. #13
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Brilliant, last piece of the puzzle solved.
    Much appreciated Ali

  14. #14
    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,728

    Re: Using IF & Lookup Function

    No worries. Good luck with your exams!

  15. #15
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi Ali,

    Sorry to be a pain one last time but I decided to add an extra column in a different part of my sheet for an extra test. Could you please help me with a new formula for Column H, as it doesn't appear to work now.

    I appreciate all your help so far
    Many thanks
    Attached Files Attached Files

  16. #16
    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,929

    Re: Using IF & Lookup Function

    Not sure why you felt the need to change Ali's vlookup to lookup?
    =IF(D5="Y","Y",IF(VLOOKUP(E5,$Q$3:$R$6,2,1)=LEFT(B5,2),"Y","N"))

    Either way, why would you expect Y in H5?
    your critieria says find 100 in your criteria range, which returns 05
    B5 contains 04A
    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

  17. #17
    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,929

    Re: Using IF & Lookup Function

    A slightly shorter version of that formula...
    =IF(OR(D4="Y",VLOOKUP(E4,$Q$3:$R$6,2,1)=LEFT(B4,2)),"Y","N")

  18. #18
    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,728

    Re: Using IF & Lookup Function

    Explain why you think H5 and H26 should now be "Y"? I don't agree.

  19. #19
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,
    Thanks for the reply.
    I believe H5 should be Y as they scored 83, which is in the criteria range of 69-84 for O4, likewise H26 should be Y as a score of 114 is in the Level 5 criteria range (110-124). I hope that makes sense?

    I appreciate any further help

  20. #20
    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,929

    Re: Using IF & Lookup Function

    Quote Originally Posted by Jones90 View Post
    ...I believe H5 should be Y as they scored 83, which is in the criteria range of 69-84 for O4...
    They only scored 83 if you look in col G. All your formulas, and from what you said (unless I missed something?) was that you wanted to look at col E!

    Why col G now, and how would we know which is which?

  21. #21
    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,728

    Re: Using IF & Lookup Function

    It's time for you to take a moment to understand the formulae we are giving you to work with. If you carry on using them blindly, you will never be able to tweak them as your spreadsheet evolves. So, what is it about the formula I offered that you do not understand?

  22. #22
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,
    I want the second 'match' column (H) to look up scores from column E, F, G. If ANY (1 or more) of these scores correspond correctly to the criteria given in the tables I would like it to show Y in column H. If none of these do then it would show N.

    Apologies if this was not clear in advance, and thank once more for taking your time to reply

  23. #23
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,

    I want the first 'match' column (P.W.AE) to look up scores from the column to the left, and see if it corresponds to the correct outcome/level against the criteria in the table AK/AL. I also want the second 'match' column (S, AA, AI) to look up scores from three columns the column to the left, against the outcome/level against the criteria in the table AK/AL.

    If ANY (1 or more) of these scores correspond correctly to the criteria given in the tables I would like it to show Y in column H. If none of these do then it would show N. If Y is already in the first match column, it would show Y in the second match column irrespective if those do not correspond.

    I posted this previously and appreciated the help, but have since added more columns which I could not get the formula to work. Pupil 2 in FPh sheet should show as Y in second column, as should (KS2) Pupil 7 in English, Pupil 4 in Maths/Procedural as well as a few others (clearly the current formula needs amending).

    Apologies if this was not clear in advance, and thank once more for taking your time to reply
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Hi,

    I want the first 'match' column on each table & page (P/W/AE), to look up scores from the column to the left (O/V/AD), and see if it corresponds to the correct outcome/level (N/U/AC), against the criteria in the table (AK/AL). I also want the second 'match' column (S, AA, AI) to look up scores from three columns the column to the left (Q-R, X-Z, AF-AH), against the outcome/level against the criteria in the table AK/AL.

    If ANY (1 or more) of these scores correspond correctly to the criteria given in the tables I would like it to show Y in column H. If none of these do then it would show N. If Y is already in the first match column, it would show Y in the second match column irrespective if those in the second set of scores do not correspond.

    Thank you for taking your time to reply

  25. #25
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Using IF & Lookup Function

    Please try at Comparative Report FPh
    S4
    =IF(P4="Y","Y",IF(SUMPRODUCT(--(LOOKUP(Q4:R4,$AK$3:$AK$6,$AL$3:$AL$6)=LEFT(N4,2))),"Y","N"))

    AA4
    =IF(W4="Y","Y",IF(SUMPRODUCT(--(LOOKUP(X4:Z4,$AK$3:$AK$6,$AL$3:$AL$6)=LEFT(U4,2))),"Y","N"))
    Attached Files Attached Files

  26. #26
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Fantastic, the comparative FPh works accurately.

    Would you happen to help on the KS2 one also please? I have tried copying and pasting the formula given for FPh but it doesn't seem that straight forward.
    Many thanks

  27. #27
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Using IF & Lookup Function

    Already done, please check attached on post#25.

  28. #28
    Registered User
    Join Date
    10-01-2017
    Location
    Wales
    MS-Off Ver
    2017
    Posts
    62

    Re: Using IF & Lookup Function

    Now I see, much appreciated again.
    Thank you

  29. #29
    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,728

    Re: Using IF & Lookup Function

    Your post does not comply with Rule 3 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please make sure to include the full link, so that other members will be permitted to continue helping you

    Note that if you have fewer than 10 posts, you may need to type the link, or past it in pieces (or ask a mod to do that for you)

  30. #30
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Using IF & Lookup Function

    Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.

+ 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] Use of INDEX with or without MATCH function or Lookup function
    By GStone in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-07-2018, 09:52 AM
  2. [SOLVED] Nest lookup Function to lookup name between date range and return value
    By bbeards in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-17-2018, 01:37 PM
  3. lookup based on cellvalue... without the lookup function needed
    By NoSleepForMe in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-16-2016, 04:54 AM
  4. Time Intervals, Ranges, IF function, Lookup Function
    By HDTV in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-23-2014, 03:52 PM
  5. [SOLVED] A lookup function based on two criteria; one unique & one not unique to the lookup table
    By Trevasaurus in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-18-2014, 11:35 AM
  6. Create a lookup formula with an If or Lookup function
    By afountas21 in forum Excel General
    Replies: 2
    Last Post: 09-05-2012, 06:53 PM
  7. [SOLVED] Pivot table doing a lookup without using the lookup function?
    By NGASGELI in forum Excel General
    Replies: 0
    Last Post: 08-02-2005, 01:05 AM

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