+ Reply to Thread
Results 1 to 7 of 7

Comparing a value to table of values for result

  1. #1
    Registered User
    Join Date
    01-27-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Comparing a value to table of values for result

    Thanks for any help I can get with this. I have tried looking for something similar but have found it difficult to translate other responses to my problem.

    I want to be able to compare a value (F6 - score) to a table of values (scores by age and gender) based on data from B6 (age) and C6 (gender) and then return either a 'low concern' or 'elevated concern' result in F7.

    I started mapping it out as - If(B6=8 (years of age) & C6='male' (gender), then if (F6 (score) >42, 'elevated concern' (result)) but not really sure if this is right. I hope this makes sense.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Comparing a value to table of values for result

    Hello tkendell,

    Welcome to the Forum!

    To help you get answers that quick and accurate, please post your code, workbook, or both. It will make it easier to follow what you're talking about. Also, if your workbook in is Excel 2007, you should also post a copy in Excel 2003 format, since there are still many us using that version.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Comparing a value to table of values for result

    So for the one example you've given:

    =IF(AND(B6=8,C6="male",F6>42),"elevated concern","low concern")

    Or, to put the score outside the AND:

    =IF(AND(B6=8,C6="male"),IF(F6>42,"elevated concern","low concern"),"")
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Registered User
    Join Date
    01-27-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Comparing a value to table of values for result

    Thanks for the feedback. My database is huge so I have posted an example. I want to compare the score in the first table to the scores in the second table based on the age and gender of the person and then return a result of either "concern" or "no concern".

    Hopefully that makes a bit more sense.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-27-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Comparing a value to table of values for result

    Thanks for that - I think this might work. If i have multiple ages (eg 8 - 11) do I have to do a seperate If function for each age value?

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Comparing a value to table of values for result

    First, put the FEMALE row above the MALE so it's alphabetical, then this formula will do the trick:

    =IF(D4>INDEX($H$4:$I$5,MATCH(C4,$G$4:$G$5,1),(MATCH(B4,$H$3:$I$3,1))),"concern","no concern")
    Attached Files Attached Files
    Last edited by JBeaucaire; 01-28-2009 at 12:35 AM. Reason: copied formula incorrectly, fixed it, replaced book, too

  7. #7
    Registered User
    Join Date
    01-27-2009
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Comparing a value to table of values for result

    Hi J

    It's kind of working but not for all values. have decided to upload a more detailed table to see if that helps your formula. With the age range (8-11, 12-15) would I need to extend this out into their own individual columns? Thanks for all your help. I think I am almost getting it.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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