[英]Excel: Check if cell value already exists in column, and then substract and show another value
I have 2 sheets, first one with values asigned to certain names我有 2 张纸,第一张有指定给某些名称的值
And second one is a control list Wich I update everyday:第二个是我每天更新的控制列表:
I want to get this updated list to show updated values while I add new rows, for example, if LEG "1" is already shown in the table, and I add a row at the bottom, value of "COR" (column D) should show value-SAL (column E).我想让这个更新的列表在我添加新行时显示更新的值,例如,如果表中已经显示了 LEG“1”,并且我在底部添加一行,“COR”的值(D 列)应显示值-SAL(E 列)。 Here's an image of what i'm looking to achieve, made by hand for the example:
这是我想要实现的图像,为示例手工制作:
As you can see, in first place column D for LEG1 is 14, but as I take 7 off of it (SAL, column E) when I call the same value again in row 8, column D shows 7.如您所见,首先,LEG1 的 D 列是 14,但是当我在第 8 行再次调用相同的值时,我从它(SAL,E 列)中取出 7,D 列显示 7。
The same should happen if called it again at the bottom:如果在底部再次调用它,也会发生同样的情况:
Hope you understand what I'm trying to explain, this is my first time here!希望你能理解我要解释的内容,这是我第一次来这里!
Thanks in advance.提前致谢。
EDIT: This is what I got until now:编辑:这是我到现在为止得到的:
----A----------B---------C
1---x----------8---------3
2---y----------9---------2
3---z----------7---------3
4---y----------7---------3
5---x----------5---------5
6---x----------5---------0
7---y----------4---------2
8---y----------2---------2
9---z----------4---------4
0---y----------2---------0
============================================================= ================================================== ============
This is the initial table that you would see.这是您将看到的初始表。 As I explain in column headers, values are called from DATA sheet, to be later modified in BASE sheet:
正如我在列标题中所解释的,值是从数据表中调用的,稍后会在 BASE 表中进行修改:
As values are then called again on this table, newly added rows should check previous inputs and substract them, in order to see how many "items" are available left to take (image shown below is manually edited, not actually working like this right now):当值在这个表上再次被调用时,新添加的行应该检查以前的输入并减去它们,以查看还有多少“项目”可供选择(下图是手动编辑的,现在实际上不是这样工作的):
Ames answer almost got it, values are showing up as they sould (with substractions made) but there's a little "glitch" (should I call it like that?) that makes all previous values from that person change, and that isn't expected to happen:艾姆斯的回答几乎明白了,价值在他们的灵魂中出现(做了减法)但是有一个小“故障”(我应该这样称呼它吗?)使那个人以前的所有价值都改变了,这是意料之中的即将发生:
If you know a little tweak that would make this 100% functional, would be highly appreciated.如果您知道可以使此 100% 正常工作的小调整,将不胜感激。
Formula in use is: =INDICE(DATA!C$2:C$7;COINCIDIR(A2;DATA!A$2:A$7;0))-SUMAR.SI.CONJUNTO(D:D;A:A;A2)+D2
使用的公式是:
=INDICE(DATA!C$2:C$7;COINCIDIR(A2;DATA!A$2:A$7;0))-SUMAR.SI.CONJUNTO(D:D;A:A;A2)+D2
In English: =INDEX(DATA!C$2:C$7,MATCH(A2,DATA!A$2:A$7,0))-SUMIFS(D:D,A:A,A2)+D2
英文:
=INDEX(DATA!C$2:C$7,MATCH(A2,DATA!A$2:A$7,0))-SUMIFS(D:D,A:A,A2)+D2
Thanks in advance!提前致谢!
update (fix updating previous values):更新(修复更新以前的值):
Try this - formula starting from cell D2:试试这个 - 从单元格 D2 开始的公式:
=INDEX(I$2:I$7,MATCH(B2,G$2:G$7,0))-SUMIFS(E$2:E2,B$2:B2,B2)+E2
In Spanish:在西班牙语中:
=INDICE(I$2:I$7,COINCIDIR(B2,G$2:G$7,0))-SUMAR.SI.CONJUNTO(E$2:E2,B$2:B2,B2)+E2
update 2:更新2:
Based on the new tabular format.基于新的表格格式。
Formula for Column B (Name): B 列(名称)的公式:
=INDEX(G$2:G$7,MATCH(A2,F$2:F$7,0))
=INDICE(G$2:G$7,COINCIDIR(A2,F$2:F$7,0))
Formula for Column C (Left): C列的公式(左):
=INDEX(H$2:H$7,MATCH(A2,F$2:F$7,0))-SUMIFS(D$2:D2,A$2:A2,A2)+D2
=INDICE(H$2:H$7,COINCIDIR(A2,F$2:F$7,0))-SUMAR.SI.CONJUNTO(D$2:D2,A$2:A2,A2)+D2
give this a try.试试这个。 paste into cell D8.
粘贴到单元格 D8 中。
=VLOOKUP($B8,$B:$D,3,FALSE)-SUMIFS($E$1:$E7,$B$1:$B7,B8) =VLOOKUP($B8,$B:$D,3,FALSE)-SUMIFS($E$1:$E7,$B$1:$B7,B8)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.