从您的问题来看,您似乎想使用条件格式来更改数字的格式设置(对于绝对值四舍五入到小数点后两位的数字,是< = 0.01,则应使用小数点后0位(即显示为0)的格式设置.
From your question, it seems like you want to use conditional formatting to change how the numbers are formatted (for numbers whose absolute value, rounded to 2 decimal places, is <= 0.01, they should be formatted with 0 decimal places, i.e., show as 0).
这完全可以通过条件格式来实现(不需要VBA).
This can absolutely be achieved with conditional formatting (no VBA required).
- 选择要应用条件格式的单元格.
- 打开条件格式规则管理器,然后创建.
- 选择使用公式来确定要格式化的单元格,然后输入用于标识要格式化的单元格的公式(确保避免使用绝对引用).
- 点击格式按钮,然后选择数字> 0个小数位()
- 单击确定" 3次以返回到电子表格,您应该看到所需格式的值:
- Select the cells you wish to apply the conditional formatting to.
- Open the Conditional Formatting Rules Manager, and create a .
- Select Use a formula to determine which cells to format, enter the formula that identifies the cells you wish to format (make sure you eschew absolute references).
- Click the Format button and select Number > 0 Decimal places ()
- Click OK 3 times to return back to the spreadsheet, and you should see the values formatted as desired: