Forum Discussion

BariDoc ESPCOP's avatar
BariDoc ESPCOP
Copper Contributor
Oct 01, 2017

IF Function to adjust calculations for gender

New to this - please be patient :-)

Medical application. Have one of two formulae to use to calculate lean body weight, depending on gender of patient in column A (M or F). there must be a simple and elegant way to either choose or adjust the formula in column D, depending on what is in column A.

 

Sorry, no this must be so basic, just couldnt see it anywhere back in the thread..  

7 Replies

  • BariDoc ESPCOP's avatar
    BariDoc ESPCOP
    Copper Contributor
    Hi Detlef - many thanks, looks v elegant, but using Excel for Mac the O365 version - it returns a #NAME error.. tried repeatedly to jiggle this around - is it a version problem?
    • CARLOS ADRIAN's avatar
      CARLOS ADRIAN
      Copper Contributor

      Other proposal would be:

      =9270*B3/IF(A3="m",(6680+216*C3),(8780+244*C3))

    • IngeborgHawighorst's avatar
      IngeborgHawighorst
      MVP

      Hello,

       

      this one is not as elegant, but it works in all versions of Excel:

       

      =9270*B3/(IF(A3="m",6680,8780)+IF(A3="m",216,244)*C3)

      • BariDoc ESPCOP's avatar
        BariDoc ESPCOP
        Copper Contributor

        yup, that's the Badger!  does the job. Many thanks to you and all who suggested solutions.

    • Detlef_Lewin's avatar
      Detlef_Lewin
      Silver Contributor

      BariDoc,

       

      probably. SWITCH() was introduced with version 1601 Build 6568.2025.

       

  • Detlef_Lewin's avatar
    Detlef_Lewin
    Silver Contributor

    BariDoc,

     

    one of many ways:

    =9270*B3/(SWITCH(A3,"m",6680,"f",8780,0)+SWITCH(A3,"m",216,"f",244,0)*C3)

Resources