【问题标题】:Comparative condition in table表中比较条件
【发布时间】:2015-07-11 10:06:10
【问题描述】:

如果 Total Deposit 表小于 Total Cost 表,我想要下面的 Excel 表 - 它会在 Manager Get 表中自动减去,并且如果 Total Deposit 表大于 Total Cost 表 - 它会在 Customer Get 表中自动减去。如果 Total CostTotal Deposit 相等,则 Customer getManager Get strong> 表格显示 NO Due非常抱歉,由于我的声誉不佳,我无法上传 excel snap-short 图像。但我是通过 html 代码做到的。为了澄清我的问题,请运行代码

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 2px;
}
</style>
</head>
<body>

<table style="width:100%">
  <tr>
    <th>Total Cost</th>
    <th>Total deposit</th>		
    <th>Customer Get</th>
    <th>Manager Get</th>
  </tr>
  <tr>
    <td>2700</td>
    <td>2500</td>		
    <td>-</td>
    <td>-</td>

  </tr>
  <tr>
    <td>2500</td>
    <td>2900</td>		
    <td>-</td>
    <td>-</td>

  </tr>
  <tr>
    <td>2300</td>
    <td>2300</td>		
    <td>-</td>
    <td>-</td>

  </tr>
</table>

</body>
</html>

【问题讨论】:

  • 在我意识到您只是向我们展示使用 HTML 的 excel 表格之前,我花了一点时间。我还没有看到有人这样做。
  • 非常抱歉,由于我的声誉不佳,我无法上传 excel snap-short 图片。因此,我通过 html 代码进行了上传。@chancea
  • 我真的觉得它有点酷。这是我能够直接将 SO 中的某些内容复制并粘贴到 excel 中的唯一方法。
  • 随便!首先,我要感谢您的回复。我猜你解决了我的问题@chancea。

标签: excel conditional


【解决方案1】:

看来你有3个条件:

如果 Total Deposit 表小于 Total Cost 表 - 它会在 Manager Get table

自动减去

如果 Total Deposit 表大于 Total Cost 表 - 它是 在Customer Get表中自动减去

如果 Total CostTotal Deposit 相等,则 Customer getManager Get 表格显示没有到期

我相信我们可以使用 2 个公式来实现这一点。假设数据从 A1 开始:

客户获取公式

=IF(B2>A2,B2-A2,IF(B2=A2,"NO Due","-"))

经理获取公式

=IF(B2<A2,A2-B2,IF(B2=A2,"NO Due","-"))

然后您可以自动向下填充公式:

Total Cost     Total deposit        Customer Get                              Manager Get
2700           2500                 =IF(B2>A2,B2-A2,IF(B2=A2,"NO Due","-"))   =IF(B2<A2,A2-B2,IF(B2=A2,"NO Due","-"))
2500           2900                 =IF(B3>A3,B3-A3,IF(B3=A3,"NO Due","-"))   =IF(B3<A3,A3-B3,IF(B3=A3,"NO Due","-"))
2300           2300                 =IF(B4>A4,B4-A4,IF(B4=A4,"NO Due","-"))   =IF(B4<A4,A4-B4,IF(B4=A4,"NO Due","-"))

结果如下:

Total Cost  Total deposit   Customer Get    Manager Get
2700        2500            -               200
2500        2900            400             -
2300        2300            NO Due          NO Due

【讨论】:

    猜你喜欢
    • 2015-09-15
    • 1970-01-01
    • 2021-01-28
    • 2013-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多