How to Fix Excel REPT Function Incorrect Results Due to Rounding
Question details
The user needs to fix the REPT function returning fewer characters than expected due to floating-point precision rounding errors.

- 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.
Ensure you have the exact formula causing the issue and identify which part of the formula calculates the repeat count.
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.
Click on the cell containing your faulty REPT formula to make it active.
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.
Enclose this calculation within the ROUND function, specifying 0 decimal places. For example, change it to ROUND((1-A1)*10, 0).
Your final formula should look similar to =REPT("_", ROUND((1-A1)*10, 0)). Press Enter to apply the fix and verify the output.

Combine INT and ROUND Functions for Strict Integer Conversion
Use both INT and ROUND functions if your workflow specifically requires strict downward integer truncation after rounding.
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. Open your workbook: Launch WPS Spreadsheet and open the file containing the formula error.
- 2. Select the target cell: Click on the cell with the REPT function that is missing characters.
- 3. Edit the formula: Navigate to the formula bar and insert the ROUND function: =REPT("_", ROUND((1-A1)*10,0)).
- 4. Apply the correction: Press Enter to instantly apply the corrected formula and view the accurate character count.

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.




