Welcome to Catalog Tips

Search more than 200 articles to learn more about creating and automating your product catalogs

Tip: Start typing in the input box for immediate search results.

< All Topics
Print

DECTOFRAC – Convert decimal to fraction

Overview

This Custom Field converts a decimal value to a fraction, with the option of adding HTML formatting to the result string around the numerator and denominator.

Syntax

DECTOFRAC(0.5, TRUE)

Element Description
0.5 A decimal figure (e.g. 0.5, 0.75 or 2.25) to be converted to a fraction
TRUE Specifies whether or not to add HTML formatting (can be TRUE or FALSE)

Example

DECTOFRAC(0.5) will return ‘1/2’

DECTOFRAC(0.5, FALSE) will return ‘1/2’

DECTOFRAC(0.5, TRUE) will return ‘<sup>1</sup>/<sub>2</sub>’

DECTOFRAC(0.25) will return ‘1/4’

DECTOFRAC(0.625, FALSE) will return ‘5/8’

DECTOFRAC(0.75, TRUE) will return ‘<sup>3</sup>/<sub>4</sub>’

See also

FRACTODEC

Table of Contents