How to display a decimal as a fraction
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Show 0.625 as 5/8 — recipes, measurements, stock-style pricing.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =TEXT(A2,"?/?") | As a cell format (Ctrl+1 → Fraction) the value stays numeric. "# ?/?" shows mixed numbers like 1 3/8. |
| Google Sheets | =TEXT(A2,"?/?") | Identical; custom format # ?/? via Format → Number → Custom. |
| LibreOffice Calc | =TEXT(A2,"?/?") | Identical. |
How it works
The ?/? format code finds the nearest single-digit fraction: 0.625 becomes exactly 5/8. Fix the denominator by writing it literally — "?/8" forces eighths, "?/16" sixteenths (0.6 as ?/8 shows the nearest: 5/8). More ?s allow bigger denominators ("??/??" gets 0.333 → 33/99... actually 1/3). Prefer the CELL format over TEXT when you still need to calculate with the value — TEXT output is a string.
Verified, not just documented
We ran =TEXT(A2,"?/?") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 5/8 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 5/8 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
TEXT — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to abbreviate large numbers as K and M
- How to add leading zeros to a number
- How to concatenate a date with text (without getting a number)
- How to convert 12-hour text times to 24-hour
- How to convert a date to text