Calculation Issues

How to Fix Excel REPT Function Incorrect Results Due to Rounding

Rana GarciaRana Garcia Nov 10, 2026 869 views

Question details

The user needs to fix the REPT function returning fewer characters than expected due to floating-point precision rounding errors.

How to Fix Excel REPT Function Incorrect Results Due to Rounding
Product
Excel
Device & OS
not provided
Scenario
Using the REPT function where the repeat count is calculated from decimal percentages.
Observed behavior
The REPT function outputs fewer characters than intended because internal binary representations of decimals are slightly smaller than their displayed values.
Before you start

Ensure you have the exact formula causing the issue and identify which part of the formula calculates the repeat count.

Solution 1Recommended

Use the ROUND Function to Correct Floating-Point Errors

Wrap the repeat count calculation in a ROUND function to ensure the exact integer is passed to the REPT function.

Binary floating-point precision in spreadsheet software can cause decimal values to be stored as slightly smaller numbers. Since the REPT function truncates decimals to integers instead of rounding them, it might repeat a character fewer times than expected.

1
Select the formula cell

Click on the cell containing your faulty REPT formula to make it active.

2
Locate the repeat count calculation

In the formula bar, identify the portion of the formula that calculates the number of times to repeat the character, such as (1-A1)*10.

3
Apply the ROUND function

Enclose this calculation within the ROUND function, specifying 0 decimal places. For example, change it to ROUND((1-A1)*10, 0).

4
Complete and apply the formula

Your final formula should look similar to =REPT("_", ROUND((1-A1)*10, 0)). Press Enter to apply the fix and verify the output.

Use the ROUND Function to Correct Floating-Point Errors
Precision Restored: Using ROUND forces the slightly off decimal back to the exact whole number before REPT evaluates it, preventing truncated characters.
Free Microsoft Office alternative

Fix Formula Precision Issues Easily with WPS Spreadsheet

WPS Spreadsheet provides robust calculation tools and full compatibility with Excel functions like REPT, ROUND, and INT, helping you build accurate data models without precision errors.

  1. 1. Open your workbook: Launch WPS Spreadsheet and open the file containing the formula error.
  2. 2. Select the target cell: Click on the cell with the REPT function that is missing characters.
  3. 3. Edit the formula: Navigate to the formula bar and insert the ROUND function: =REPT("_", ROUND((1-A1)*10,0)).
  4. 4. Apply the correction: Press Enter to instantly apply the corrected formula and view the accurate character count.
Fully compatible with Microsoft Excel formulas, functions, and file formats (XLSX, XLS).Lightweight and fast, ensuring smooth calculations even with complex data models.Free built-in tools for data analysis, formatting, and error checking.Familiar user interface for a seamless migration from Microsoft Office.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the REPT function cut off characters when using decimals?

The REPT function only accepts whole numbers for its repeat count. If you provide a decimal, it truncates (cuts off) the decimal part rather than rounding it to the nearest whole number. Combined with floating-point errors, this often results in one less character being displayed.

What is binary floating-point precision error?

It is a standard limitation in how computers store fractional numbers. Certain decimal values, like 0.1 or 0.9, cannot be represented perfectly in binary. This results in an internal value that is fractionally smaller, such as 0.899999999999999, which causes functions like REPT to truncate the number prematurely.

Can I use the ROUNDUP function instead of ROUND to fix this?

Yes, in cases where you always want to round to the next whole number regardless of the decimal value, replacing ROUND with ROUNDUP will work. However, the standard ROUND function with zero decimal places is usually the safest and most accurate method for correcting minor floating-point discrepancies.