+ Reply to Thread
Results 1 to 10 of 10

Formula to correctly identify the answer from 2 criteria

  1. #1
    Forum Contributor
    Join Date
    01-12-2021
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    118

    Formula to correctly identify the answer from 2 criteria

    Hi,
    I have a table with 3 categories "Hemisphere", "Country" and "Town".
    I have a formula that will bring back the first correctly identified Hemisphere based on the Town. However I need a formula that will bring back the Hemisphere based on Town and Country. How do I do this please?

    I have included the excel workbook with the formulas I am using.
    Thanks!
    Attached Files Attached Files
    Last edited by awoolfe; 01-20-2021 at 02:48 AM. Reason: Update excel file

  2. #2
    Forum Expert
    Join Date
    09-07-2014
    Location
    Israel
    MS-Off Ver
    office 365 for MAC
    Posts
    3,105

    Re: Formula to correctly identify the answer from 2 criteria

    Hi,
    What should be the right answers? Can you please fill in the table manually?

  3. #3
    Forum Contributor
    Join Date
    01-12-2021
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    118

    Re: Formula to correctly identify the answer from 2 criteria

    Sure. I've uploaded it with correct answers.

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

    Re: Formula to correctly identify the answer from 2 criteria

    For the country, which I am sure you will be able to adapt for hemisphere yourself:

    =IFERROR(LOOKUP(2,1/((DataSet[Hemisphere]="Northern")*(DataSet[Town]=D3)),DataSet[Country]),"")
    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 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,780

    Re: Formula to correctly identify the answer from 2 criteria

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  6. #6
    Forum Contributor
    Join Date
    01-12-2021
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    118

    Re: Formula to correctly identify the answer from 2 criteria

    Thanks @AliGW for helping me with the formula:
    =IFERROR(LOOKUP(2,1/((DataSet[Hemisphere]="Northern")*(DataSet[Town]=D3)),DataSet[Country]),"")

    This worked in my example excel sheet, however because I don't fully understand it I am having trouble translating it to my actual excel sheet. I searched youtube but all the videos were on index and match.

    I am wondering what the "2" and "1" and "/" stand for? I am wondering if you could write out the formula in simple words and I will try it again?

    Thanks

  7. #7
    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,780

    Re: Formula to correctly identify the answer from 2 criteria

    Don’t worry about the start of the formula, because you don’t need to change it. I will post a link to a clear explanation of it later.

    All you need to know are that the criteria columns are in the first part of the formula:

    ((Lookupcolumn1=Lookupcriterion1)*(Lookupcolumn2=Lookupcriterion2))

    This establishes the ‘filters’, if you like, to hone in on the correct row - in your case you need to match the hemisphere and the town to ensure that the correct country is found. The value you want to return is the lookup column at the end of the formula.

    What is happening when the formula executes is that Excel is creating matrices of true/false returns, and the row on which it finds the intersection of two trues is where it will find the correct answer. Use Evaluate Formula on the Formulas ribbon to step through the formula in the sample workbook to see how it is working. You can add more criteria if you have extra columns that need matching.

  8. #8
    Forum Contributor
    Join Date
    01-12-2021
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    118

    Re: Formula to correctly identify the answer from 2 criteria

    Thanks @AliGW !! Definitely user error. I did get it to work on my excel sheet. In terms of the formula, I understand the "1/" to create an error. I don't understand the "2" for the lookup value. I'll have a read of the link when you post it.

  9. #9
    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,780

    Re: Formula to correctly identify the answer from 2 criteria

    You don't need to - any number above 1 will do!

    Here's that link to an explanation of a similar formula - the bit about the 2 and 1 holds true for your formula, too: https://www.excelforum.com/excel-for...ml#post3398950

  10. #10
    Forum Contributor
    Join Date
    01-12-2021
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    118

    Re: Formula to correctly identify the answer from 2 criteria

    Thank you!!

+ 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. Formula to identify multiples with 2 criteria
    By BG1983 in forum Excel General
    Replies: 1
    Last Post: 11-23-2015, 05:21 PM
  2. formula that will check multiple criteria before returning an answer
    By workingmom434 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-14-2014, 01:37 PM
  3. Replies: 0
    Last Post: 02-01-2013, 09:26 PM
  4. [SOLVED] Sort function does not correctly reference the answer from the input box.
    By herbie226 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-16-2012, 10:30 AM
  5. Formula to identify correct answer by searching thru other columns
    By aalbertson in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 03-28-2011, 04:48 PM
  6. Replies: 3
    Last Post: 01-13-2010, 05:03 PM
  7. [SOLVED] Answer:How to type correctly formula in calculated field in a pivot?
    By bj in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 04:05 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