从第一个单元格中删除最后一个单元格的数字

时间:2015-06-20 09:31:58

标签: excel find row difference subtraction

我有以下Excel表格 enter image description here

在第J列中,我需要行中第一个单元格与最后一个单元格(带数字)之间的最终差异。

数字可以从C列出现,直到第一列。数字并不总是从C列开始,并且不总是在第I列结束,但它们之间从不存在空单元格。

基本上我需要用带有数字的最后一个单元格中的数字减去第一个单元格中的值。 C-I范围内的最后一个值减去该范围内的第一个值,结果显示在J. 我现在手动填写了J栏,不过我想用公式做。

1 个答案:

答案 0 :(得分:1)

If the numbers are always ordered from smallest to largest, you could simply do this:

 =MAX(C2:I2)-MIN(C2:I2)

If not, things become a bit more difficult. Here's another solution that should work for non-ordered entries:

First, add an empty column to the right of Totaal.

Second, add seven columns with the following contents:

=IF(ISBLANK(C2),M2,C2)
=IF(ISBLANK(D2),N2,D2)
...

Third, add another empty column.

Fourth, add seven columns with the following contents:

=IF(ISBLANK(C2),S2,C2)
=IF(ISBLANK(D2),T2,D2)
...

Totaal can then be calculated with

=Z2-L2