Calculation Tips
From Fmfaq
Go back to Quick Tips
Creating Fractions
Case( PatternCount(Fraction, "/") = 0, Fraction, Left(Fraction, Position(Fraction, " ", 1, 1) - 1) (Middle(Fraction, Position(Fraction, " ", 1, 1) 1, Position(Fraction, "/", 1, 1) - Position(Fraction, " ", 1, 1) - 1) ) / Right(Fraction, Length(Fraction) - Position(Fraction, "/", 1, 1) ) )
[Contributed by Matt ]
Determining a Leap Year
Working with date based calculations? Wondering how to account for February 29th every four years? Use this calculation to determine if a year is a leap year or not.
Case(
IsEmpty(Current Date), TextToNum(""),
Mod(Year(Current Date),4) = 0
and
Mod(Year(Current Date),100) <> 0
or
Mod(Year(Current Date),400) =0 , 1, 0
)
[Contributed by Matt ]
Alternatively, test to see if February 29th falls in February, not March.
month(date(2,29,year(theDate)) = 2
(Just in case They change the rules one day ;-)
[Contributed by Eric ]
