I am trying to find a string in excel cells, and it works to some extent, but when the value returns false I simply get "FALSE" in the cell, although when it returns a true value it actually changes the cell to what I have defined in the IF statement.
Is this because I have inserted the concatenate query incorrectly in the if statement?
My formula is as follows:
=IF(ISNUMBER(SEARCH(ET2:ET4,B2)),"yes",F2=CONCATENATE("NA ",B2))
The reason you get false is the bit that says
F2=CONCATENATE("NA ",B2)
I think you're trying to use this as an assignment (ie set the cell F2 to the value of the ConCat).
What it will actually do is compare the value of F2 and the value of the concat, and return TRUE if they are equal and FALSE otherwise. This TRUE or FALSE value is what you are ending up with in your cell.
So to fix it:
If the above formula is in the cell F2, then just remove the F2= from the formula and it should work.
If the above formula not in the cell F2, then you need to put either this same formula or a slightly altered one into that cell to populate F2.
Related
I'm trying to have one column change color (individual cells in that column, rather) depending on if there is text in a different cell in the same row. I've tried using something along the lines of =IF(($B1<>""), TRUE, FALSE) and that works, but when I try to copy that formatting to the rest of the column, the cell number that the formula references stays the same, so every cell in column A will reference cell B1 instead of changing the reference cell to B2, B3, etc... on down the column.
The problem with your formula i'm assuming is the $ sign which is an absolute reference. So if you use $B1 in your formula, you're saying that you need to always compare against the value in column B.
using this formula should probably work for you:
=IF(B1<>"", TRUE, FALSE)
But it also depends on the range that you're applying this conditional-format on.
TIP:
You don't even have to use the IF function, B1<>"" returns TRUE or FASLE by default.
Cell A1: K+
Cell B1: P(K, G, Y)
I would like it to return true in C1 if A1 contains any characters in B1. The current formula that I could think of is:
IF(ISNUMBER(SEARCH(RIGHT(B1,LEN(B1)-2),B1))=LEFT(A1,1),"T","F")
I know the formula is wrong, however I am stuck in identifying the correct formula.
This is an array formula:
=OR(IFERROR(FIND(MID(A1,ROW($A$1:INDEX($A:$A,LEN($A1))),1),$B1),FALSE))
To enter/confirm an array formula, hold down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula seen in the formula bar.
For a normally entered formula, if you have the AGGREGATE function, you can use:
=IFERROR(AGGREGATE(14,6,FIND(MID(A1,ROW($A$1:INDEX($A:$A,LEN($A1))),1),$B1),1)>0,FALSE)
The formula is case-sensitive. To make it case-insensitive, change FIND to SEARCH
Algorithm:
Split A1 into an array of one character elements:
MID($A1,ROW($A$1:INDEX($A:$A,LEN($A1))
Try to FIND each character in that array in B1
This will return an array of #VALUE! errors and digits depending on whether the character is found or not.
IFERROR to return FALSE since FIND will return an error if it does not find the character.
Now we have an array of {TRUE,FALSE}
OR will then return TRUE if any one of the characters is found, else FALSE
For the AGGREGATE function
It will return the a number > 0 if FIND matches something in B1.
AGGREGATE can be set to ignore the errors
Again, if nothing is found, then AGGREGATE will return an error, since there are not digits, and the IFERROR will convert that to FALSE
Try this non-array formula,
=ISNUMBER(LOOKUP(1,-FIND(MID(A1,ROW($A$1:INDEX($A:$A,LEN($A1))),1),B1)))
I'm checking in Excel if a text in a cell in a column is within the text at another column.
Example text to search:
Column A
1. a
2. b
3. c
Text to search within:
Column B
1. aagg
2. hgjk
3. dhhd
4. bahj
5. adjd
This formula works:
=SUMPRODUCT(--ISNUMBER(SEARCH(A$1:A$3,B1)))
But this one works only for the first cell and for the rest I get #VALUE! error:
={(SEARCH(A$1:A$3,B1))}
Column B
aagg -> 1
hgjk -> #VALUE!
dhhd -> #VALUE!
bahj -> empty cell
adjd -> empty cell
Also the second formula is only giving results for the first three cells, as many as the number of cells in column A. The last two are empty.
What makes SEARCH work with SUMPRODUCT but cannot work alone as an array formula?
Let's assume we have the following data...
A1:A3
a
b
c
B1
oboe
In this case, SEARCH(A$1:A$3,B1) returns the following array of values...
#VALUE!
2
#VALUE!
If the formula is entered in a single cell, only the first value from this array gets transferred to this cell. So, in this case, #VALUE! will be display in the cell.
However, if you select three cells, then enter the formula, and then confirm with CTRL+SHIFT+ENTER, all three values from the array gets transferred to these cells.
Note, though, since A1:A3 is a vertical range of cells, you'll need to select a vertical range of cells in which to return these values. For example, you could select D1:D3, then while these three cells are selected enter the formula, and then confirm with CTRL+SHIFT+ENTER.
Now, for the interesting part. To return TRUE or FALSE, you'll need to first pass the array of values returned by SEARCH to ISNUMBER, and then you'll need to pass the array of values returned by ISNUMBER to the OR function, which in turn will return TRUE if at least one of the values returned by ISNUMBER is TRUE. Otherwise, it returns FALSE. So, you would use the following formula, which needs to be confirmed with CTRL+SHIFT+ENTER...
=OR(ISNUMBER(SEARCH(A$1:A$3,B1)))
Here's how the formula is evaluated...
=OR(ISNUMBER(SEARCH(A$1:A$3,B1)))
=OR(ISNUMBER(SEARCH({"a";"b";"c"},"oboe")))
=OR(ISNUMBER({#VALUE!;2;#VALUE!}))
=OR({FALSE;TRUE;FALSE})
...which returns TRUE. By the way, ISNUMBER is needed here. We can't simply pass the array of values returned by SEARCH to the OR function. If we did, the OR function would return #VALUE!, since the array of values contains an error value, in this case #VALUE!. That's why we use ISNUMBER, so that any error value gets converted to FALSE before passing it the OR function. So the OR function will always get an array of values made up of TRUE and/or FALSE.
Hope this helps!
I have an excel spreadsheet. I need to check if the value in a cell in column A is present in any cell in columns B, C and D.
Here is my current formula:
=AND( NOT(ISNA(VLOOKUP($A2,$B:$B,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$C:$C,1,FALSE))), NOT(ISNA(VLOOKUP($A2,$D:$D,1,FALSE))) )
This formula works, in that if the value in A2 is present in a cell in column B, C, and D it will return true - It returns false if not.
What I'm looking to do is to return the value in A2 when the match is correct.
Thanks in advance.
To solely answer your question, you can just put this around your formula:
= IF(<your formula>,A2)
This returns whatever is in cell A2 if your formula evaluates to TRUE, and returns FALSE otherwise.
More Info, Suggest you Read
You're not really using VLOOKUP for it's intended purpose. VLOOKUP is used when you want to find a match in a table, then return some other value in the table with the same vertical index.
Since you just want to determine if a certain value is in a range or not, VLOOKUP is overkill.
Instead of VLOOKUP inside the IF statement, you should just do this:
= IF(AND(COUNTIF($B:$B,A2),COUNTIF($C:$C,A2),COUNTIF($D:$D,A2)),A2)
This should return the same result but is shorter and more efficient.
I have a sheet where a cell D2 has a formula i.e.
=ISNUMBER(SEARCH("exception",$A2))
It returns TRUE or FALSE. Now i have another cell where it should return the heading of the column if it has TRUE in it. So I tried :
=IF(D2="TRUE","Unhandled Exception")
But as it returns FALSE whatever I do, I think its because D2 has a formula in it so it is not returning the value even if TRUE is present.
I came across the same problem yesterday.
Try changing your formula to
=IF(D2=TRUE,"Unhandled Exception")
Since the cell will have the value True, not the string "true"