简体   繁体   English

Excel-在X列中查找最后一个相同的值,并将Y列添加到当前单元格

[英]Excel - Find last same value in Column X and add Column Y to current cell

I have a sheet that includes (3) different sources of information, where the source is determined in ColumnA, MoneyOut = ColumnB, MoneyIn = ColumnC, and SourceTotal = ColumnD. 我有一张工作表,其中包括(3)个不同的信息源,其中信息源在ColumnA中确定,MoneyOut = ColumnB,MoneyIn = ColumnC,并且SourceTotal = ColumnD。

When working with a current row, how can I find the last row in which ColumnA = CurrentRowColumnA[Value], and sum(PrevColumnB[Value]+PrevColumnC[Value]) to CurrentRowColumnD[Value]. 在处理当前行时,如何找到ColumnA = CurrentRowColumnA [Value]并将sum(PrevColumnB [Value] + PrevColumnC [Value])与CurrentRowColumnD [Value]相加的最后一行。

Ex: 例如:

A1 = Source1
B1 = 200
C1 = 200
D1 = 400

A2 = Source2
B2 = 300
C2 = 200
D2 = 500

A3 = Source1
B3 = 200
C3 = 600
D3 = 1200 (D1 + sum(B3+C3))

How can I write a function to do this continuous addition without having to do a different sumifs for each row? 我如何编写一个函数来执行此连续加法,而不必为每行做不同的求和?

I've tried: Assuming I'm on D4... 我尝试过:假设我在D4上...

=SUM(IF(A:A=$A4, B4+C4))+IF($A3=$A4, D3)

Which will work for the first few, but once there is another source, this formula doesn't work. 它将对前几个有效,但是一旦有了另一个来源,此公式将不起作用。

Should I be using an OFFSET() function? 我应该使用OFFSET()函数吗?

Formula: 式:

=SUMIF($A$1:$A1,$A1,$B$1:$B1)+SUMIF($A$1:$A1,$A1,$C$1:$C1)

Use this in your example sheet to get the result you want. 在示例表中使用它来获得所需的结果。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果列a包含x,则在与x相同的行中找到y并显示值 - If column a contains x find y in same row as x and display value Excel-在当前日期内查找列中的最后一个值 - Excel - find last value in column within current date 查找 EXCEL 中每个第一列单元格的第二列集合的最后一个单元格值 - Find the Last Cell Value of the 2nd Column Set for each 1st Column Cell in EXCEL 在第 1 列中找到相同的值,如果第 2 列中的所有值都是 X,则在第 3 列中给出 Y - Find same value in column 1, if all values are X in column 2, give Y in column 3 如果Cell为X,则在VBA Excel中的整个列上,右侧单元格的值将为Y. - If Cell is X then Value of the Cell to its right will be Y, across entire column in VBA Excel Excel公式:如果列B的值在X和Y之间,则添加列A的值 - Excel formula: Add Column A value if Column B value is between X and Y 公式来查找列中最后一个填充的单元格并添加到它? - Formula to find the last populated cell in a column and add to it? Excel - 查找单元格,导航到左侧的列,获取该列的最后一个非空值 - Excel - Find cell, navigate to column to the left, get last non-empty value of that column VBA Excel按包含“X”的行和包含“Y”的列获取单元格地址或值 - VBA Excel Get Cell Address or Value by Row containing "X" and Column containg "Y" 根据列标题在最后一个单元格中查找值 - Find value in the last cell based on column header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM