How to display a decimal as a fraction
✓ Verified in LibreOffice 25.8.7.3Show 0.625 as 5/8 — recipes, measurements, stock-style pricing.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel | =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. Every formula here is confirmed by actually executing it.