简体   繁体   English

如果列x包含字符串,则将值乘以-1

[英]Multiply value by -1 if column x contains a string

Basically what i want to do is to express my excel column sum in -ve if the value in Action is Sell . 基本上,我想做的就是如果Action的值是Sell则在-ve中表达我的excel列总和。 If its Buy then don't do anything. 如果Buy则什么也不做。 Currently, I am doing sum like =B2+C2 but it will always be in +ve no matter if it is representing a purchase or sell order. 当前,我正在执行=B2+C2之类的总和,但是无论它代表购买还是出售订单,它总会处于+ ve状态。

Here is some sample data 这是一些示例数据

在此处输入图片说明

Notice how Net column shows +ve value even though one value is Sell and the other one is Buy . 请注意,即使一个值是Sell ,另一个值是Buy Net列也如何显示+ ve值。 I want Sell to be displayed as +ve value and Sell to be shown as -ve value. 我希望将Sell显示为+ ve值,将Sell显示为-ve值。

我能够使用=IF(B2="Buy", G2+F2, -1*(G2+F2))解决我的问题。

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

相关问题 如果A列包含x AND B列包含y然后添加值 - If column A contains x AND column B contains y THEN add value 如果 X 列包含值,则将 Y 列值添加到工作表范围 - If column X contains value, add column Y value to worksheet range 如果列a包含x,则在与x相同的行中找到y并显示值 - If column a contains x find y in same row as x and display value Excel-在列中添加所有X,然后相乘 - Excel - add all X in column and then multiply PowerBi - DAX - 如果字符串包含,则在新列中分配一个值 - PowerBi - DAX - assign a value in a new column if string contains 在Tableau中将列每年乘以恒定值 - Multiply a column by a constant value per year in Tableau 将列中的值乘以100,基于另一列的值,引用表 - Multiply value in a column by 100 based on the value of another column, referencing a table 如果列B中的任何单元格包含字符串X,则删除行并向上移位单元格 - If any cells in column B contains string X, delete row and shift cells up 根据包含一些字符串的列标题值删除excel宏中整列的方法 - Way to delete the entire column in excel macro based on column header value that contains some string Excel:如何在包含字符串的列中查找单元格并在另一列行中返回单元格的值? - Excel: How to find cell in a column that contains a string and return value of a cell in another column of row?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM