且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Excel中向单元格添加规则?

更新时间:2023-12-03 11:53:04

从您的问题来看,您似乎想使用条件格式来更改数字的格式设置(对于绝对值四舍五入到小数点后两位的数字,是< = 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).

  1. 选择要应用条件格式的单元格.
  2. 打开条件格式规则管理器,然后创建.
  3. 选择使用公式来确定要格式化的单元格,然后输入用于标识要格式化的单元格的公式(确保避免使用绝对引用).
  4. 点击格式按钮,然后选择数字> 0个小数位()
  5. 单击确定" 3次以返回到电子表格,您应该看到所需格式的值:
  1. Select the cells you wish to apply the conditional formatting to.
  2. Open the Conditional Formatting Rules Manager, and create a .
  3. 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).
  4. Click the Format button and select Number > 0 Decimal places ()
  5. Click OK 3 times to return back to the spreadsheet, and you should see the values formatted as desired: