+ Reply to Thread
Results 1 to 9 of 9

IF the condition of gender is met AND the condition of age is met subtract this number

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2016 & 365
    Posts
    49

    IF the condition of gender is met AND the condition of age is met subtract this number

    I am not a program and have limited understanding of excel but have been successful with past help so I thought I would try again. I hope I am attaching my spread sheet.

    I need to create a function for cell E9 that will look at cell D4(gender) AND cell C5 (age in days) and choose the correct value J3:M3 (boys) or O3:R3 (girls) to subtract form cell C9.

    I tried =IF(D4=2(AND(C5<E3,sum(C9,-5),FALSE)) but did not get anywhere. Any assistance would be greatly appreciated.


    CI formula.xlsx

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    Try this
    =IF(and(d4=2,c5<e3),c9-5,0)
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

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

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    Try

    =$C9-INDEX(OFFSET($J3:$M3,0,(2-$D$4)*5),MATCH($D$3-$B$3,$E$2:$E$5))

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    Using your posted workbook...
    This regular formula returns the intersect of Age Range and Scale in the appropriate Gender table
    Please Login or Register  to view this content.
    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    id change the age range column using edate to set the boundaries as that will allow for leap years and drop the & d of of the days formula
    so c5 is
    =DATEDIF(B3,D3,"d")


    so e2:e5 become

    e2= 0
    e3 =DATEDIF($B$3,EDATE($B$3,96),"d")
    e4 =DATEDIF($B$3,EDATE($B$3,132),"d")
    e5 =DATEDIF($B$3,EDATE($B$3,168),"d")
    then
    e9

    =C9-IF($D$4=2,INDEX($J$3:$M$13,MATCH(A9,$I$3:$I$13,0),MATCH($C$5,$E$2:$E$5,1)),INDEX($O$3:$R$13,MATCH(A9,$N$3:$N$13,0),MATCH($C$5,$E$2:$E$5,1)))
    Attached Files Attached Files
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    11-09-2012
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2016 & 365
    Posts
    49

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    Thank you for your trouble. I could not get it to work and my knowledge limits my problem solving it but I do appreciate the time. martindwilson's code worked for my purposes so I am good to go.

    Thanks again

  7. #7
    Registered User
    Join Date
    11-09-2012
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2016 & 365
    Posts
    49

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    This worked perfectly. Thanks you so much for your help and trouble. Now I can get to the fun of using the workbook!

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    Based on your last post in this thread, its apparent that you are satisfied with the solution(s) you've received and have solved your question, but you haven't marked your thread as "SOLVED". I will do it for you this time.

    In future, to mark your thread as Solved, you can do the following -
    Select Thread Tools-> Mark thread as Solved.

    Incase your issue is not solved, you can undo it as follows -
    Select Thread Tools-> Mark thread as Unsolved.

    Also, since you are relatively new to the forum, i would like to inform you that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post which helped you. This adds to the reputation of the person who has taken the time to help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  9. #9
    Registered User
    Join Date
    11-09-2012
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2016 & 365
    Posts
    49

    Re: IF the condition of gender is met AND the condition of age is met subtract this number

    I realized I had not marked it as "Solved" at about 2 in the morning in the middle my attempt to sleep. sorry. Thanks for marking it for me.

+ 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] Help for if condition formula result only either hit or miss from mulitple condition
    By breadwinner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-09-2013, 07:29 AM
  2. check for condition"Number or not" and subtract
    By kannanr03 in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 08-03-2012, 12:35 PM
  3. ADD or SUBTRACT based on condition
    By ranjitbd in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 12-01-2010, 04:52 PM
  4. Replies: 6
    Last Post: 05-06-2010, 10:06 PM
  5. multi condition format? lookup and date condition valid for.
    By D_Rennie in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-13-2009, 11:37 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