简体   繁体   English

Google表格:用于根据另一个单元格的值修改一个单元格的值的case语句或ifelse公式?

[英]Google sheets: Case statement or ifelse formula to modify a cell's value based on the value of another cell?

  1. Based on a validation, if A1 = 20, then B1 = 5. 根据验证,如果A1 = 20,则B1 = 5。
  2. Based on a formula, B2 = B1. 根据公式,B2 = B1。

Except, I want B2 = B1 + D1, if C1 = True. 除非,如果C1 = True,我希望B2 = B1 + D1。

My question is: How do I make it so that the formula for one cell (B2) equals the sum of two cells (B1,D1) in the event that a third cell (C1) has a True value? 我的问题是:在第三个单元格(C1)具有True值的情况下,如何使一个单元格(B2)的公式等于两个单元格(B1,D1)的总和? If it is False, I want it (B2) to just equal the sum of one cell (B1). 如果为False,我希望它(B2)等于一个单元格(B1)的总和。

So in B2: 因此在B2中:

=B1+IF(C1="True",D1,0)

If C1 is TRUE then it can be shortened to: 如果C1为TRUE,则可以缩短为:

=B1+IF(C1,D1,0)

在此处输入图片说明

=if(C1=true,sum(B1,D1),sum(B1))

在此处输入图片说明

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM