Forum Discussion

Kevin_decs's avatar
Kevin_decs
Copper Contributor
Jan 10, 2023

Splitting fractions from whole numbers

Can anyone help me, I want split a number of hours in to weeks, days and hours in three seperate fields, rather do a simple divide that will give me a decimal answer. Thank you

  • Kevin_decs 

    Let's say you have a number of hours in D2.

    The number of weeks is =QUOTIENT(D2,168)

    The number of days is =QUOTIENT(MOD(D2,168),24)

    The number of hours is =MOD(D2,24)

    These formulas can be filled down if required.

  • Kevin_decs 

    Let's say you have a number of hours in D2.

    The number of weeks is =QUOTIENT(D2,168)

    The number of days is =QUOTIENT(MOD(D2,168),24)

    The number of hours is =MOD(D2,24)

    These formulas can be filled down if required.

    • PeterBartholomew1's avatar
      PeterBartholomew1
      Silver Contributor

      HansVogelaar 

      This is your method so I am replying to you.

      Worksheet formula
      = SplitByUnitsλ(targetList)
      
      SplitByUnitsλ(target)
      = LET(
          multiples, {52,7,24},
          Quotientλ, LAMBDA(x, y, QUOTIENT(x, y)),
          lower,     SCAN(PRODUCT(multiples), multiples, Quotientλ),
          upper,     lower * multiples,
          values,    QUOTIENT(MOD(target, upper), lower),
          values
        )

       

Resources