Trying to create an If Statement with a number of conditions - excel-formula

Formula conditions are
Cell D5 to equal M
Cell F5 to be 0 or greater than 0
Cell H5 to be 0 or greater than 0 and is a percentage
First condition is that D5 equals M.
If false the result is 0
Second condition is that Cell F5 is greater than zero.
If both are true the result is F5.
If first is true, second is false, and third is true, the result is the calculation.
I have used the following code which calculates correctly but when cell D5 is not M, I get the calculation value
I8 = IF(AND(D5="M",F5>0),F5,(B8/1.1)*H5)
I have tried the following code also
I8 = =IF(AND(D5="M",F5>0),IF(AND(D5="M",F5=0),((B8/1.1)*H5)))
but the result is "FALSE"
Any help would be greatly appreciated as I'm going around in circles

See if this does what you want:
=IF(D5<>"M",0,IF(F5>0,F5,H5*(B8/1.1)))

Replace the text with your calculation.
You have an uncoverd case. First true, second false and third false. If you need something more please leave a comment.
I8=IF(D5="M",IF(F5>0,F5,IF(H5>=0,"YourCalculation","First true, second and third false")),0)

Related

IF condition when value is not 0 and not empty

I have the following formula
=IF((AND($R$29="12+",D16<>0)),D2, IF((AND($R$29="12+",D16<>"")),D2,""))
and right now
R29 is equal to 12+
D16 is empty
But on the cell that my formula is at I get the value of D2 rather than an empty cell and I'm not sure why as I told the formula to show an empty cell if there is nothing on D16 and R29 = 12+.
Can somebody help me figure out what I am doing wrong?
The excel if statement is =IF (logical_test, [value_if_true], [value_if_false])
in your code you switched the true with the false
so right now in the =IF((AND($R$29="12+",D16<>0)),D2,IF((AND($R$29="12+",D16<>"")),D2,""))
The first part returns true because (AND($R$29="12+",D16<>0) is actually true, so is does the true part of the statement witch is D2
The correct formula should be:
=IF((AND($R$29="12+",D16<>0)),IF((AND($R$29="12+",D16<>"")),"",D2),D2)

Excel formula if returns false

I have the following formula:
=IF(I2=0;IF(D2="*CONTADO*";K2=I2;K2=7);K2=I2)
For some reason it returns FALSE, where it should copy the value of I2 or else make it 7.
Aside of that, I don't know if the right way to make a "contains" is just asterisk inside the quotes.
EDIT:
formula now reads as:
=IF(I2=0;IF(OR(ISNUMBER(SEARCH("ALBARAN";D2));ISNUMBER(SEARCH("CONTADO";D2)));I2;7);I2)
It returns false when it matches the searched words in the cells.
I did a small test with
=ESNUMERO(BUSCAR("CLAVIJA";D3))
(to clarify it, Spanish Excel translates every formula name (sigh). ESNUMERO is ISNUMBER and BUSCAR is SEARCH. I've been translating it the whole time for your understanding.)
and did an auditory of the formula. It gets a #N/A when finding "CLAVIJA" even in the cell reads just like that. The value of D3 is "CLAVIJA MULTIPLE 10-16A T.T.LA".
Here in image you can see, you can achieve your desired results, I have done with 3 test cases
FORMULA TO DO =IF(I2=0,IF9D2="CONDTADO",12,7),I2)
B2 0 D2 *CANTADO* I2 0 K2 0 L2 OUTER AND INNER IFS ARE TRUE
B3 3 D3 *CANTADO* I3 3 K3 3 L3 0 OUTER IF IS FALSE
b4 7 D4 *CANTAD* I4 0 K4 7 L4 0 OUTER IF IS TRUE BUT INNER IS FALSE
Solved by replacing SEARCH by FIND.

Excel formula for comparing 2 cells with values

I need a formula that displays the below, but cannot for the life of me get it to work:
If A1 is not blank, B1 must be 'yes' (I want either a 0 or 100 to be displayed in C1 dependant on result).
Thanks,
You'll need to chain a few functions together. The first is ISBLANK() which, as it sounds, tells you if the value provided is blank. As you mentioned, you want the case when it's not blank, so you'll need to enclose this in the NOT() function, which will reverse the boolean result.
For example, when B1's formula is =ISBLANK(A1), the result is FALSE when A1 is not blank. Since you want it to be TRUE, you'll use =NOT(ISBLANK(A1)).
To get B1 to show a value besides TRUE or FALSE at this point, you can use the IF() function, which allows you to specify a value to be shown when the result is TRUE and a different value for FALSE.
In your case, =IF(NOT(ISBLANK(A1)),'yes','no') should give you yes when A1 is not blank, and no when A1 is blank.
You can also utilize the IF() function in C1 to do your additional "0 or 100" logic.
So:
A1
Project one
B1
Yes or No
C1 - if project one, is 'yes' then value to be 100, if project one is 'no' then value to be 0.
You Can Use If Condition.
Formula Is :
If(A1=B1,"Match","Not Match")
Where A1,B1 Cell Values ,
If Condition Is True Than Match Will Execute Otherwise Not Match Will Execute.
Write This Condition in C1 Cell
Excel Formula:
=IF(ISBLANK(A1), "No", "Yes")

Check if a range of cells has any number bigger or smaller than 0

Is there a way to identify in column L if any of the cells between C and K contain a number greater or smaller than zero?
If yes it should return TRUE if not it should return FALSE. So in the example picture rows number 4 and 6 should return FALSE and rows number 1,2,5 should return TRUE.
Please try in L2 and copied down to L6:
=COUNTIF(C2:K2,"<>"&0)<>0
This assumes there will only ever be numbers, not strings, in the range C2:K6. For L7 you might want:
=COUNTIF(L2:L6,"FALSE")
If you want to return False where all cells between column C and K contain '0' and return True for all other instances you could use:
=(CONCATENATE(C2,D2,E2,F2,G2,H2,I2,J2,K2)<>"000000000")
Or a shorter version:
=IF(COUNTIF(C2:K2,"<>0"),"True","False")
EDITED AGAIN - As per pnuts answer, this COUNTIF solution won't account 0 entered as a string, but the CONCATENATE one should
In L2 you could use a formula like this:
=IF(OR(C2<>0;D2<>0;E2<>0;F2<>0;G2<>0;H2<>0;I2<>0;J2<>0;K2<>0);TRUE;FALSE)
and then just drag it down.
It will Return TRUE if there is a Value uneven 0 otherwise it will return FALSE.
If none of the cells from c2-k2 contain a value less or greater than zero, the sum of c2-k2 is 0 else the sum is less or greater than 0
=IF(SUM(C2:K2)<>0;TRUE;FALSE)
Use Array formula:
Enter the below formula in the cell L2 and press Ctrl+Shift+Enter
=AND(C2:K2>0)
You will get either TRUE or FALSE as answer

Detailed explanation of =IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1)?

I need to count unique values in Excel Pivot 2010. I tried the approach from here
But I do not understand how this formula works =IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1)
SUMPRODUCT accepts array arguments, however $A$2:$A2=A2 is boolean .
1 ) Let's assume $A$2:$A2=A2 is TRUE and $B$2:$B2=B2 is FALSE, then does it become SUMPRODUCT(TRUE * FALSE ) OR SUMPRODUCT (1 * 0 )
2) I tried a random table
A B
1 year id
2 1990 1
3 1991 2
4 1992 3
I tried using this formula =A1:B4=2 and it threw an error ? So why does not $A$2:$A10=A10 throws an error and what does it exactly mean?
=IF(SUMPRODUCT(($A$2:$A2=A2)*($B$2:$B2=B2))>1,0,1)
Let's assume $A$2:$A2=A2 is TRUE and $B$2:$B2=B2 is FALSE
You get: SUMPRODUCT(TRUE*FALSE) which then is interpreted by excel to be SUMPRODUCT(1*0), becoming 0.
When you drag the formula now, let's say, one cell down, the references will become:
=IF(SUMPRODUCT(($A$2:$A3=A3)*($B$2:$B3=B3))>1,0,1)
And you get array results. Let's say now that you drag it once more:
=IF(SUMPRODUCT(($A$2:$A4=A4)*($B$2:$B4=B4))>1,0,1)
And let's say that A2 = A3 <> A4 and B2 = B3 = B4. You get:
=IF(SUMPRODUCT({FALSE, FALSE, TRUE}*{TRUE, TRUE, TRUE})>1,0,1)
Which becomes:
=IF(SUMPRODUCT({0, 0, 1}*{1, 1, 1})>1,0,1)
This becomes:
=IF(SUMPRODUCT({0, 0, 1})>1,0,1)
SUMPRODUCT({0, 0, 1}) is 1.
The whole formula thus returns 0.
1 will be returned only when either the last cell in the column A, or in column B is different from the first cell (and if the range is only 1 cell big).
EDIT:
As to your example, array formulas outside array functions tend to either return the first value, or a value depending on what row/column it is, or plainly an error.
What you can do to check the results is to press F2 on the cell with the error, and then press F9. For your example, you should get something like:
{FALSE, FALSE, FALSE, FALSE; FALSE, FALSE, TRUE, FALSE}

Resources