Excel formula if returns false - excel

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.

Related

Calculate current streak in Excel row

I have a list of 1s and 0s in excel row ranging from B2:K2, I want to calculate the current streak of 1's in cell M2,
example dataset where streak would be 4
1 0 1 0 1 1 1 1 0
Is there a simple way of doing this? I have tried research but not been able to find anything specific.
Any help would be much appreciated.
Here is a way of doing this with just one formula, no helper columns/rows needed:
The formula used translates to:
{=MAX(FREQUENCY(IF(B1:K1=1,COLUMN(B1:K1)),IF(B1:K1=1,0,COLUMN(B1:K1))))}
Note: It's an array formula and should be entered through CtrlShiftEnter
Assuming your data is layed out horizontally like the image below, the following two formulas should do it for you.
The first cell requires a different formula as the is no cell to the left to refer to. so a simple formula to check if the first cell is one or not is entered in B2.
=--(A1=1)
The part in the bracket will either be true or false. A quirk of excel is that if you send a true or false value through a math operation it will be converted to 1 for true and 0 for false. That is why you see the double - in front. could have also done *1, /1, +0,-0 at the end.
In B2 place the following formula and copy right as needed:
=(A2+1)*(B1=1)
Basically it adds 1 to the series, then check if the number in the sequence is 1 or 0. In the event its one, it keeps the value as it is TRUE sent through the math operator *. If it is false it set the sequence back to zero by multiplying False by the math operator *.
Alternate IF
Now the above while it works and may save a few characters is not necessarily intuitive for most. The go to option would be to use an IF function. The above formulas can be replaced with the following:
A3
=IF(A1=1,1,0)
B3 ->Copied right
=IF(B1=1,A3+1,0)
Longest streak
To get the longest streak, the highest value in your helper row is what you want. You can grab this with the following formula in an empty cell.
=MAX(2:2)
=MAX(A2,I2)
If you have no other numbers in your helper row, you can use the first formula which looks in the entire row. If there are other numbers due to calculations off to the left or right as an example, then you will want to restrict your range to you data as in the second formula.
I've put those values in cells B2 to B8.
In cell C3, I've put this formula:
=IF(AND(B3=1;B2=1);C2+1;1)
Dragging this downto C8, and then take the maximum of the C column.

from LOOKUP function to VLOOKUP

I'm trying to use VLOOKUP excel function instead of LOOKUP.
I've read VLOOKUP is well optimized but I'm not able to adjust it.
Any help please?
Following function return:
1 if first condition met is >
-1 if first condition met is <
=LOOKUP(2,1/((E1:E9>E10)-(E1:E9<E10)))
Scope of function is: looking to E10 value, searching on range E1:E9 starting from bottom to top, if firstly appear a number > or < of E10, returning +1 or -1
Example 1
E1 = 6
E2 = 5
E3 = 5
E4 = 4
E5 = 6
E6 = 6
E7 = 5
E8 = 8
E9 = 8
If E10 = 8
Result is -1 because first value found is smaller than E10 (starting from E9 and going up)
If E10 = 7
Result is 1 because first value found is bigger than E10 (starting from E9 and going up)
??
=VLOOKUP(2,1/((E1:E9>E10)-(E1:E9<E10));1)
or any other function instead of LOOKUP?
Previous supposed solution works correctly
=VLOOKUP(2,1/((E1:E9>E10)-(E1:E9<E10));1)
but formula needs to be entered with:
CTRL+SHIFT+ENTER
I've tried with MATCH but to me result to don't work correctly.
Any other ideas?
Returning to my first function:
=LOOKUP(2,1/((E1:E9>E10)-(E1:E9<E10)))
I've scomposed it, to understand how it works, to find others possible solutions.
Firstly Excel convert my condition into TRUE and FALSE
IF E10=8
=LOOKUP(2,1/((FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE)-(TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE)))
Next it converts TRUE and FALSE into 1 and 0
=LOOKUP(2,1/((0,0,0,0,0,0,0,0,0)-(1,1,1,1,1,1,1,0,0)))
Next it makes "-" operation obtaining:
=LOOKUP(2,1/(-1,-1,-1,-1,-1,-1,-1,0,0))
Next it converts into arrays:
=LOOKUP(2,{-1,-1,-1,-1,-1,-1,-1,#Div/0!,#Div/0!},ROW(E1:E9))
Next converts also ROW(E1:E9) into arrays obtaining:
=LOOKUP(2,{-1,-1,-1,-1,-1,-1,-1,#Div/0!,#Div/0!},{1,2,3,4,5,6,7,8,9})
To conclude looks from bottom to top of range, searching for a value close to 2, returnig -1 because E7=5 and is smaller than E10=8
So now, understanding how Excel elaborates is possible to use following function to obtain arrays:
=INDEX(1/((E1:E9>E10)-(E1:E9<E10)),0)
resulting in the same:
{-1,-1,-1,-1,-1,-1,-1,#Div/0!,#Div/0!}
and using previous result combined with VLOOKUP, to get same result of LOOKUP function, but accepting it whitout CTRL+SHIFT+ENTER that was my goal
=VLOOKUP(2,INDEX(1/((E1:E9>E10)-(E1:E9<E10)),0),1)

Excel: How ro write Mutiple IFs in in same formula and formula not pulling correct value?

I am having trouble with the formula below as it is not pulling the correct value or perhaps the formula needs to be tweaked.
=IF((AND(Sheet1!H10>65,D17>=65)),Sheet2!D$47,VLOOKUP(D17,Sheet2!$A$2:$K$51,4,FALSE))
What I am basically trying to do is if the value in H10 is greater than 65 and the value in D17 > or = 65 then pull the value from sheet2 D47 cell. Other wise use vlookup to lookup the value.
I have a case where The value in D17 =66 however, it is returning the value based on the vlookup and not Sheet2-D47.
Also, is it possible to have multiple IFs in the same formula?
Where are you writing the formula? If your formula isn't on sheet1 D17 might be pointing at the wrong cell. It sounds like it would be pointing to the correct D17 if your vlookup is working though. Remember with an AND formula, all conditions need to be true. Is H10>65? if not then even with D17 = 66 then if statement will return false and execute the vlookup.
And yes you can have nested if statements (I believe 7 is the most). but you can do:
=if(A5>5, if(A5 = 7, "A5 is greater than 5 and equals 7", "A5 is greater than
5, but does not equal 7"),"A5 is less than 5)

Excel return value or run calculation if criteria is not met. Formula needed

This is a fairly simply formula that I need syntax for. I do not know the syntax that Excel will accept.
Formula:
I want to return a value of "0" if the target cell has a value of "2" or less.
If the value is greater than "2" I want to multiply by "25".
I tried the below formula but my syntax is all wrong and am not sure where to look for correct syntax:
=IF(B2<2,0),(B2>2, B2*25)
Thank you for any help.
First, note the proper syntax for the IF() function:
IF(logical_test, value_if_true, [value_if_false])
The logical_test is B2 <= 2.
The value_if_true_ is 0.
The value_if_false (i.e., if B2 is > 2) is B2 * 25.
So the formula is =IF(B2<=2, 0, B2*25).
For example (data starting in B2, formula in C2):
[B] [C]
[2] 0 0
[3] 1 0
[4] 1.9 0
[5] 2 0
[6] 2.1 52.5
7 3 75
8 4 100
Follow-up from comments:
How would I set this formula so the value couldn't go over a certain number... ie I don't want it to return values over 100 and instead set the value to 100 if it would be higher.
Now you want another IF() function as to evaluate what you do if B2 > 2:
=IF(B2<=2, 0, IF(B2*25>100, 100, B2*25))
if(b2<2,0,b2*25) <- should work

IF Function does not show false

Newbie in Stackoverflow.
Question 1. Am doing an IF formula in Excel but the resulting cell computes and returns a true data each time and no false is recognized. Here are the values
K4 is 1 and L4 is 10
I want M4 to show:
If K4>=6
Then M4 must show K4 plus (L4 divided by 12 months)
Or show Not Eligible if false
Here, my M4 is showing 1.833 instead of Not Eligible. I am using this formula in M4, IF(K4>=6, SUM(K4+(L4/12), "0"))
Question 2. How can I make the 6 in Q1.1 constant without having to type it and drag the formula in the affected cell? Can't put it in a cell, say put it in A1 and create the Q1.1 as K4>=$A$1.
i'm betting that the value in cell K4 is a string. so try something like:
if(K4*1>=6, ...)
you can check out the type with type
Let's break down your formula
IF(
K4>=6
, SUM(K4+(L4/12), "0") <~~~ SUM that makes no sense
<~~~ no statement in the ELSE part
)
I think you meant something like
IF(K4>=6, K4+(L4/12), "Not Eligible")
There's no need to SUM anything because you are already adding your two values together. Your SUM amounted to SUM(5) or whatever.

Resources