Excel "IF" function. - excel

If I want to only ask excel to calculate in a cell if TWO other cells have values in them, what is the code? I know that for it to calculate only if a single cell has a value is =if(A1=0,"",B1-B2)....but how do you add criteria that two cells have a value in them?

Example where A1 and B1 are 0:
=IF(AND(A1=0,B1=0),"",B1-B2)

With this you can verify witch cell has no value
=IF(B3="",IF(C3="","both EMPTY","B3 empty C3 with value"),IF(C3="","C3 empty B3 with value","both with value"))
You can also set cell = 0 on the comparison.

Related

Google Sheets or Excel: setting the value of a remote cell from a formula

Is there a way to create a formula in one cell that will change the value in another cell based on some criteria, without scripting? Example: cell a1 contains a numerical value. cell b1 contains a value from a drop-down list, say, "YES,NO". If cell b1 is set to "YES" I want to remove (set to zero) the value in cell a1. What I'd like to do is have a formula in cell c1 that interrogates b1 and sets the value in a1 accordingly. Is the only way achieve this writing code and using setValue?
you cant remove it without a script. you can visually hide it in various ways. if the A1 is subject of further sum (as in your case per your comment) the sum formula can be always altered to reflect desired output. example:
if your formula is
=SUM(A1, C5, D22)
you can do
=SUM(IF(B1="YES", 0, A1), C5, D22)
Use the following on the cell you need the calculation (or zero) on:
=IF (B1="YES",0,SUM(A:A))
Using the given formula, you would do the SUM calculation for the whole Column A if the value on B1 is "YES", if not, then a 0 would be placed on the cell you put the formula on.

How to count cells with a specific cell format containing zero?

How to count only cells containing zero with a specific cell format?
Take this list: A1 through A10 all contains zero. Cells A1, A4 and A5 of this range have a cell format which shows zeros as stars()*. Now, I'd like to count these three cells, stars.
You should be able to use =COUNTIF(A1:A10,0) if the value of the cell is 0. It does not matter the formating, if not try =COUNTIF(A1:A10,"*")

Is there a way to find out the values ​of 4 cells are the same or different in MS Excel

I found something confusing in Microsoft Excel.
I fill Cell A1, A2, A3, A4 with the same number 1,
then I enter the formula = A1 = A2 = A3 = A4 on cell A5,
why do I get FALSE results?
Is there a way to find out the values ​​of 4 cells are the same or different?
If all you are using is these numbers you could check for the standard deviation. If it's 0 then all values are equal:
=STDEV.P(A1:A4)
So a check for equality could look like:
=IF(STDEV.P(A1:A4),"Different","Equal)
You can compare the range with the first cell, include it in the AND function and enter it as an array formula.
It will process both text and numeric values.
=AND(A1:A4=A1)
Array formula after editing is confirmed by pressing ctrl + shift + enter
You can use COUNTIF.
This is how it works in this example:
The COUNTIF returns a count of any cells that do not contain "1" which is compared to zero. If the count is zero, the formula returns TRUE. If the count is anything but zero, the formula returns FALSE.
You can apply that to any value you want to compare. Just place it before the "<>" in the formula.
This also works for "strings".

Apply formula on condition

I'd like to add a condition to one of my Excel formulas. In Cell C1 I have a formula like this : = A1 +B1 but if cell A1 is empty but cell B1 does contain a value (or vice versa) I'd like cell C1 to stay empty.
Condition : Only apply formula if both cells contain any value.
(The formula I'm using in cell C1 calculates the difference between dates, and does this for a list of values, so it is applied on the whole range "C:C".)
Here you go
=IF(OR(A1="",B1=""),"",A1+B1)
=IF(SUM(IF(A1="",0,1),IF(B1="",0,1))<2,"",A1+B1)

IF statement in Excel - How to give value to 2 or more cells

If I have a IF statement in one of my cells, for example (this didn't work):
=IF(B6="A10VG 125/32",D4="2.67" & C6="125.0","N/A")
Q: How would I make D4 hold the value "2.67" and the cell C6 hold the value "125.0", IF B6 is equal to "A10VG 125/32"
So if one cell holds a certain condition how can I give different values to a number of different cells?
Excel functions exist to determine the value of the given cell only. Input in, output out. You will need a separate function for each cell.
Excel formulas in a cell can NOT change the values of other cells.
If you want to use formulas, then you will need to put the appropriate formula into the respective cells.
In this scenario, in D4 use the formula
=IF(B6="A10VG 125/32","2.67","N/A")
In C6 use the formula
=IF(B6="A10VG 125/32","125.0","N/A")

Resources