Excel formula mutiple condition on more one row - excel

I looking for the formula for column A (TRUE or FALSE). I check if column "C" contain "ERROR" text. Row number 2 (cell "C2") contain "ERROR" word, so the formula put "TRUE" in column "A". For now I have a formula per line: =ESTNUM(CHERCHE("ERROR";$C2)) in french or =ISNUMBER(SEARCH("ERROR";$C2))
FALSE DPS-14 OK
TRUE DPS-14 ERROR
FALSE DPS-15 OK
FALSE DPS-14 OK
I want add a condition to my formula. If a element from column "B" have a "TRUE" on column "A" then change (to "TRUE") for all same element. DPS-14 (row 2 is TRUE), also put "TRUE" on row 1 dans 3 because row 1, 2 and 3 are the same value on column "B".
TRUE DPS-14 OK
TRUE DPS-14 ERROR
FALSE DPS-15 OK
TRUE DPS-14 OK

I would solve this with a quick COUNTIFS.
=COUNTIFS($B$2:$B$5, B2, $C$2:$C$5, "ERROR") > 0
Here's a Picture!
Basically, it just takes the current value on the line you're on, checks through the whole range for other values like itself, and then counts the number of ERROR's associated with that value. If it's greater than zero, you've got an error in at least one spot, so the record has an error.
There's a second easy option. If you can sort your data, sort first by the ID, then by whether or not it's an Error or OK (Descending). Then, if you call an index/match on the OK/ERROR column, and it's ERROR, you know it needs to be bool TRUE for all records.
That looks like this!
I know that in your data, that column doesn't literally say ERROR, so you'll need to modify this to either make a helper column to extract which records have ERROR values, or use an array formula with your other formulas. I'd recommend option 1, as it is a higher performance solution and more likely to be understood by other people looking at your work.

Related

How to give a value to a column based on other columns

I have a excel sheet.
I have many values going down columns 1,2,3 (1000) and I want to have a new column, 5, which returns the following value depending on what is in the other cells:
if column 4 is Y, return N
Just some straightfoward logic with IF, AND, and NOT:
=IF(D2,"Going",IF(AND(A2,B2,NOT(C2)),"Away",IF(AND(NOT(A4),NOT(B4),C4),"Soon")))
Note that this formula will return FALSE for any possibilities besides the three you outlined. If that's not desired, you can add "" for example as the last option: ...,"Soon","".
This is you can achieve with simple if formula -
IF(D2=TRUE, "GOING", IF(AND(A2=TRUE,B2=TRUE,C3=FALSE),"AWAY",IF(AND(A2=FALSE,B2=FALSE,C2=TRUE),"SOON")))
Note - if cells has value as TRUE FALSE only then use it in formula without "" else you should use "" for other text.
Try this formula #D2
IF(D2=TRUE,"GOING",IF(AND(A2=TRUE,B2=TRUE,C2=FALSE),"AWAY",IF(AND(A2=FALSE,B2=FALSE,C2=TRUE),"SOON","NA")))

Excel formula to returning "Good" when all boxes are equal error

I have created a formula that returns 'good' in column S if all of the fields in the formula are the same ie. all return 'True' except only one of K or L has to be true or false. However when a field is blank such as the first cell in column O it is still giving a "good" in Col S however it should give a "" as it is not equal to True. Any idea where I am going wrong? Or how I can go about this problem better?
Use:
=IF((K1+L1)*(SUMPRODUCT(--N1:R1)=COLUMNS(N1:R1))>0,"Good","")

Search Row for Specific Text and Copy it to Cell

I wonder if anyone can help with this:
I have a sheet with rows of data. Within each row there will be a single occurrence of either 'x' or 'y', among many other entries in other columns. The string is the only text in the cell.
No row has both 'x' and 'y'.
I'd like to identify 'x' or 'y' in each row and copy the value to a new column.
In layman's terms something like;
IF row contains "x" write "x"
else If row contains "y" write "y"
else write ""
end
I have managed to get some kind of multi step process going where I use the formula below. But it is super clunky and requires many steps, copy, pasting, results etc and won't fly for the guy on Monday.
=IF(ISNUMBER(SEARCH(substring,text)), "x", "y")
Many thx
D
You can do nested IF statements. You didn't specify where you want the formula in relation to the data, but if you wanted the result in column A then you could do something like this (assuming you want the result in cell A1 and looking at data in cells in range B1:IV1)...
=IF(NOT(ISERROR(MATCH("y",$B1:$IV1,0))),"y",IF(NOT(ISERROR(MATCH("x",$B1:$IV1,0))),"x",""))
The basis of this is the MATCH() function. When a match is NOT found in the range, it returns a #NA error, otherwise it returns the location index of where the first match is. Since it throws an error when it doesn't find a match, I've wrapped the MATCH in the ISERROR function to turn it into a TRUE/FALSE boolean where TRUE is returned when it is an error and FALSE returned when it's not an error. Since that TRUE/FALSE is opposite of what you're looking for, I wrapped that in the NOT() function to reverse it...returning TRUE when it finds the match of either 'x' or 'y'.

Compare two sheets as matrix table

A1:200 B1:260
A2:300 B2:220
A3:400 B3:240
A4:200 B4:300
A5:200 B5:200
I got two tables going on and basically I want to check if row A is greater than 200 AND row B is greater than 250 then count.
So far I have this:
=COUNTIF(A1:A5,">= 200")
but I have no idea how to check if A passes then check B and if so, count it. I'm guessing something to do with IF, AND and maybe a for loop? I'm not familiar with this language at all :x
You want to calculate total count when column A is greater than 200 and B contains cell values greater than 250.
If you want a single value for entire table use countifs,
=COUNTIFS($A$1:$A$5,">200",$B$1:$B$5,">250")
If you want to get the counts in different column (let say C) on each row, then copy and paste below formula in C1 and drag it to C5 cell
=+IF(AND(A1>200,B1>250),1,0)
Where 1 means both conditions are true and 0 means either of condition is false.
However if you want to check first if the first condition is satisfying or not, then you can use below formula:
=+IF(A1>200,IF(B1>250,1,0),2)
Where "1" means true and both the condtion is satisfying , "0" means first condition is satisfying but second is not and "2" means the first condition is not satisfying hence it didn't check the second condition.
Hope this helps

Identify a subset of a range using TRUE statements

I am attempting to identify a subset of a range based on TRUE FALSE statements. An example is in the following chart below.
FALSE FALSE 1.21147
TRUE FALSE 1.20984
FALSE FALSE 1.21083
FALSE FALSE 1.210315
FALSE TRUE 1.21151
FALSE FALSE 1.21335
FALSE FALSE 1.213515
FALSE FALSE 1.212435
TRUE FALSE 1.212125
FALSE FALSE 1.21226
In this scenario I want a subset to be identified based on alternating TRUE statements. In the left side column the first TRUE statement would trigger the beginning of the subset an the TRUE statement in the second column would trigger the end of the subset. I then want to use a simple max function to identify the MAX in the third column. I would use an IF statement to determine whether or not the first TRUE statement is correct however, i am unable to figure out how to identify the subset of the range based on the TRUE statement in the second column. I also want to know whether or not this works from going from the top to the bottom if the statement could possible work going the bottom to the top. Any help would be most appreciated.
Part 1 can be done using a combination of MATCH, OFFSET and MAX
For this example I've assumed your data is located starting at cell A2.
For the sake of clarity I use some intermediate results in cells E1:E4. If you prefer a single formula, simply merge the intermediate formula into the final formula
Cell E2 = position of first TRUE in column A
=MATCH(TRUE,A2:A11,0)
Cell E3 = position of first TRUE in column B
=MATCH(TRUE,B2:B11,0)
Result formula, Max value in column C between the rows found in E2 and E3 (inclusive)
=MAX(OFFSET($C$1,E2,0,E3-E2+1,1))
Part 2 is more tricky: I don't think you can search up a range for a value. However, looking at your data it may be OK to search down for the second TRUE? If this is OK then:
Cell E4 = position of second TRUE in column A
=MATCH(TRUE,OFFSET(A2:A11,E2,0),0)
Or this, entered as an array formula (Insipred by Barry) which will get the last TRUE in the column
=MATCH(2, 1/(A2:A11=TRUE),1)
Result formula, Max value in column C between the rows found in E3 and E4 (inclusive)
=MAX(OFFSET($C$1,E3,0,E4+E2-E3+1,1))
your part about traversing the table from the bottom up confused me, and also don't know if you can have more than one subset, since you're penultimate row seems to be the opening of a new subset that is not closed. Anyway, hope that this helps. I'm assuming you don't want to use macros, in which case it would be trivial. What you can do is pad the top of the data set with an row that contains FALSE, FALSE, 0, 0, and add this formula to a fourth column starting with the first row of your set:
=IF(AND(NOT(A2),NOT(B2),OR(D1=0,AND(NOT(A1),B1))),0,C1)
That's assuming that your first row is row 2, and row 1 is used for the padding. A, B, and C are the three columns in your example, and D will print the value of the third column if it's within a subset, or zero if is not, so that you can easily calculate max() or whatever you want to do. I looks like this:

Resources