+ Reply to Thread
Results 1 to 15 of 15

Select value in table based on Gender and Weight

  1. #1
    Registered User
    Join Date
    10-16-2016
    Location
    Den Helder, The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    8

    Select value in table based on Gender and Weight

    Hello,

    Hopefully someone cant help me whit the following problem.
    In a competition I am in your Total score is corrected based on your Gender and Weight by means of a coefficient.
    Currently this is all calculated by hand because I cant figure out how i can let Excel select the applicable Coefficient.

    Please have a look at the attachment, will probably give you a much better idea of what I'm wanting to do.
    The values in RED are the expected results when i multiply the Total by the relevant Coefficient.

    Any and all help much appreciated.

    Example Sheet.jpg

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,088

    Re: Select value in table based on Gender and Weight

    Welcome to the forum!

    Images are not much use: please attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    10-16-2016
    Location
    Den Helder, The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Select value in table based on Gender and Weight

    Thanks for the quick response, See attachment for a sample workbook.
    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 (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,088

    Re: Select value in table based on Gender and Weight

    Thanks. What is the logic for choosing the correct coefficient, please?

  5. #5
    Registered User
    Join Date
    10-16-2016
    Location
    Den Helder, The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Select value in table based on Gender and Weight

    Here's the Logic;
    First select if the Person is Male or Female.
    Then Select the Weight Class in the following way. (assuming a male person here)

    Weight = 55, Weight class would be 60, cause he doe not exceed the limit (60) of that class.
    Weight = 60.00000000001, Class would be 70 because he Exceeds the limit of the previous class.
    Weight = 95.5, Weight Class would be 100+
    Weight = 110 Weight Class would be 100+ because that's the highest class

    (weight does normally not exceed 3 decimal places, so 60.00000000001 would be entered as 60,001)

    (forgot to add the + to the last weight classes in the sheet, for men it would be 100+ and for women 85+)

    Thank's a lot for the quick reply's, much appreciated.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,746

    Re: Select value in table based on Gender and Weight

    This uses a little used optional 4th argument of INDEX called [area_num]. It works well with multiple tables of identical type and layout. The thing to remember is that the first argument of INDEX ... multiple areas ... must be comma separated and enclosed in parentheses.

    The formula I used is
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    I believe my results are correct, but I don't come up with the same Female coefficients as post 1 indicates. All the Male coefficients agree however.



    Gender
    Weight
    Score 1
    Score 2
    Score 3
    Score 4
    Score 5
    Total
    End Score
    = total * Coeffiecient
    Male
    80.7
    50
    51
    60
    55
    62
    122
    158.6
    Male
    75.6
    55
    52
    58
    60
    61
    119
    166.6
    Female
    60
    40
    48
    48
    50
    0
    98
    159.74
    Male
    95.1
    60
    65
    66
    68
    0
    134
    160.8
    Female
    66.8
    45
    0
    50
    52
    53
    103
    156.56
    Dave

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,088

    Re: Select value in table based on Gender and Weight

    @Dave - thank you for this! I was looking at the area argument of the INDEX function for the first time only the other day and wondering when/how it might be used. This makes it clear - a really useful tip!

  8. #8
    Registered User
    Join Date
    10-16-2016
    Location
    Den Helder, The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Select value in table based on Gender and Weight

    @ Dave, thank's alot, gonna try this out. As for why the Female End Scores do not match the answer is the folllowing;
    159.74/98= 1.63 Which is the coeffiecient of a class lower(up to 55 instead of up to 65) the same is true for
    156.56/103= 1.52 Again a class lower then what it should be.

    Anyway's, time for lunch here and then i go and play around whit your formula a bit. Hope i can disect it correctly

    ***EDIT***
    So I just tried copy/pasting your formula but i trows me an error;
    There's a problem whit this formula

    Not trying to type a formula?
    yada yada yada

    When i press "ok" it highlights the H4, INDEX part of the formula but i cant figure out what's wrong whit it.

    Please note I am using excel 2016, where as you are using excel 2013.
    Maybe they require different formatting of formula's?

    Could you please attach the workbook whit working code to your post so i can open it in 2016 and see if that works?

    ***EDIT***
    Turns out it is because I'm in a different region I have to use ; as a argument separator instead of ,
    Changed it all over and it works, except for the wrong weight class selection for female's.
    Noticed you said about comparing identical tables so i added a line to the female reference table,
    so they both have the same number of rows, does not change anything.

    Also, if I move the values in the table up or down whithin the selected array the end product stay the same.
    So it seems that the selection criteria for the weightclass for females is different then for males,
    No idea how to fix that though.

    Actually, could it be to do whit that fact that the weight classes for males are 50, 60, 70 etc and
    for females they are 55, 65, 75 etc?
    Getting a feeling excel is using 50, 60, 70 etc for females as well.

    ***EDIT***
    See attachment, added column S to easily identify the coeffiecient used by excel and as such the selected weight class.
    (keep gender in mind)
    If you now play around whit the females weight you can see it's selecting the wrong weight classes,
    I suspect based on "higher then" instead of "lower then".
    This would also explain that if you type in a weight lower then 55 you get an "#N/A" error

    Need you lot to tell me how to solve this though

    Really appreciate the help so far.

    ***EDIT*** (again yes, cant stop messing around)

    Interesting, if you change the "male" and "female" arguments around in the formula, the problem reverses as well.
    Meaning the female values are now correct and the male values are incorrect.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    A cookie for who sorts this one out.
    Attached Files Attached Files
    Last edited by Thomas62; 10-18-2016 at 07:23 AM.

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,746

    Re: Select value in table based on Gender and Weight

    As for why the Female End Scores do not match the answer is the folllowing;
    159.74/98= 1.63 Which is the coeffiecient of a class lower(up to 55 instead of up to 65) the same is true for
    156.56/103= 1.52 Again a class lower then what it should be.
    LOOKUP behaves the other way around as it does in the Male table. I know of no way to get it to behave differently for the Female table.

    The only way I found to get the expected results was to shift the Female table coefficients upward and add another (lower) weight class. I hope this does not conflict with other purposes.



    Female
    Weight
    coefficient
    45
    1.63
    55
    1.52
    65
    1.41
    75
    1.30
    85
    1.190000000

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,746

    Re: Select value in table based on Gender and Weight

    @ AliGW

    You're welcome. Glad you like it.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,746

    Re: Select value in table based on Gender and Weight

    Thomas62,

    Here's another way.

    Invert the original Female table like this.


    Female
    Weight
    coefficient
    95
    1.190000000
    85
    1.30
    75
    1.41
    65
    1.52
    55
    1.63



    Then use this new formula (which is actually 2 formulas wrapped inside CHOOSE) in P4:P8.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This returns as sheet 'After' shows.
    Last edited by FlameRetired; 10-19-2016 at 12:39 AM.

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,088

    Re: Select value in table based on Gender and Weight

    I am using Excel 2016 and I have stepped through Dave's original formula using the evaluate formula function and, as far as I can see, the correct coefficients are being used. Dave's formula results are in green and my calculations using the coefficient chosen by Dave's formula (which is correct) are in black at the end:

    Excel 2016 (Windows) 32 bit
    G
    H
    O
    P
    Q
    R
    S
    2
    Gender Weight Total End Score
    3
    = total * Coeffiecient Coefficient used O*R
    4
    Male
    80.7
    122
    158.6
    158.6
    1.3
    158.6
    5
    Male
    75.6
    119
    166.6
    166.6
    1.4
    166.6
    6
    Female
    60
    98
    148.96
    159.74
    1.63
    159.74
    7
    Male
    95.1
    134
    160.8
    160.8
    1.2
    160.8
    8
    Female
    66.8
    103
    145.23
    156.56
    1.52
    156.56
    Sheet: After

  13. #13
    Registered User
    Join Date
    10-16-2016
    Location
    Den Helder, The Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Select value in table based on Gender and Weight

    Just re-entered it and all seems fine indeed. Gonna let this one rest for a day and then come back.
    Maybe I've just spend to much time messing around whit it and doing more harm then good.

    Thank's for the help everyone, marking this one as solved cause I'm pretty convinced it is.

    ~S~
    Thomas

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    91,088

    Re: Select value in table based on Gender and Weight

    You're welcome, Thomas!

  15. #15
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,746

    Re: Select value in table based on Gender and Weight

    You're welcome. Glad it's working out.

+ 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] Ideal Body Weight (IBW) Equations w/ Gender and Height Modifiers
    By Mlabrec in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-30-2018, 10:08 AM
  2. Weight-age Problem - Need to select Top 5 from a Given List based on 3 Parameters
    By apoorva.srivastva in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-22-2014, 02:02 AM
  3. Pivot table to split product combinations by age and gender
    By Glayva in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-01-2014, 01:13 PM
  4. [SOLVED] Comparing Male and female salaries based on Performance and gender
    By CA_needing_help in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-19-2014, 09:46 PM
  5. Automatic table generation and points allocation based on weight
    By a1exd in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-19-2013, 08:21 AM
  6. Auto Calculate Shipping Weight/Cartons and Package Weight.
    By suhailsiddiqui09 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-27-2013, 06:48 AM
  7. Pivot Formula: Gender(male)/Gender(female)
    By peterso in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2011, 04:23 PM

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