In excel, i need to check the text value of 3 cells, A1, A10 & A20 if either contains a text string CK75 then i need to add together values in cells B1, B10 & B20 and put the answer in Cell B2.
I started with an OR statement but i can only check 2 cells
=OR(B25="CK75 -Al",B27="CK75- Al")
=OR(B25="CK75 -Al",B27="CK75- Al")
I also tried this which works in part
=IF(ISNUMBER(SEARCH("CK75 - ",A20)),SUM(B1+B20),B1)
This will do it and return blank if the condition is not met:
=IF(OR(A1="CK75",A10="CK75",A20="CK75"),SUM(B1,B10,B20),"")
From the first line of your question (and your second attempt) it appears as though the text string in these cells can contain the substring, rather than exactly be the searchvalue CK75. If that is the case you could do as follow:
The formula I used translates to:
=IF(ISNUMBER(FIND("CK75",A1&A10&A20,1)),SUM(B10,B1,B20),"")
FIND() will trigger on capital/non-capital. If you dont want that to happen you should replace that with SEARCH()
Related
Suppose there is an empty excel sheet. Enter formula "=A1" into the B1 cell. The value of B1 would be 0.
My question is: why the value of B1 becomes zero when referring to an empty cell A1? Any rationales Excel behaves this way?
Thanks.
That is because the formula in B1 returns the value of cell A1.
Excel assigns the value 0 to a blank cell.
To distinguish 0 from blank, in B1 enter:
=IF(A1="","",A1)
FWIW, force a zero-length string with =A1&"". This can also be used to show (an apparently blank) cell when a VLOOKUP of INDEX/MATCH wants to return a zero after encountering a blank cell to return. Two caveats: first, a zero-length string is not truly blank and second, if used with VLOOKUP(...)&"" then any true number that should have been returned as a true number becomes text-that-looks-like-a-number. – Jeeped
Quoting the best answer so I can vote on it :)
I changed my application to =formula&"" according to Jeeped, and works great. Kinda dumb that Index returns Value(formula).
I want to make an excel formula so that, I can test out 3 columns and if they are true then to set a new value to the 4rth column.
I have this formula:
=IF(AND(A1="ALFA ROMEO"; B1="159"; C1="55");D1="2016";D1="")
and I want to check if A1 and B1 and C1 are true then to set D1 equal to a certain value.
*I've tried many complex ways to achieve it but this formula is the only one that doesnt pop up an error, but still gives back the Value FALSE(Not in D1, but in the cell I tried it). I've also tried seperating with commas etc...
Any possible help or way I could achieve the check?
It should come from the quote ("") around the number
I've try this
=SI(ET(A1="ALFA ROMEO";B1=159;C1=55);2016;"")
and it worked for me (sorry it's in french).
Maybe try to change cell format from the column B and C.
And also put the formula in cell D1 or in the cell you want the value.
You're almost there, but you need to put this formula here in cell D1 in order to fill the value of D1:
=IF(AND(A1="ALFA ROMEO", B1=159, C1=55),2016,"")
Keep out: in my locale I'm working with commas, while you might be working with semicolons, so your actual formula might be (in cell D1):
=IF(AND(A1="ALFA ROMEO"; B1=159; C1=55);2016;"")
Also, no need to put numerical values (159, 55) as strings, as you can see.
Edit: about turning B1 into a string:
I've just created this formula:
=IF(TEXT(B1,"0")="159","TRUE","FALSE")
This allows you to convert B1 into text.
So, your formula might turn into something like:
=IF(AND(A1="ALFA ROMEO", TEXT(B1, "0")="159", TEXT(C1,"0")="55"),2016,"")
(Again, mind the locale settings (commas and semicolons))
Use formula to sum cells which is reference of another cell
My requirement:
Note: Inside bracket is the formula that particular cell holds
A1(=Sheet1!A1) ==> 6
A2(=Sheet1A2) ==> 2
A3(=Sheet1!A3) ==> 2
A4 (=SUM(A1:A3)) ==> 0 (is what I am getting) but I need A4=10
Help me out with this.
As mentioned by #Scott, one of your cells probably contains a number stored as text.
To check try either selecting all the cells and setting the format or troubleshoot which cell(s) is(are) causing the problem.
=SUM(VALUE(A1),VALUE(A2),VALUE(A3))
This will convert each cell to a numeric value. If that works then start swapping out the value function for just the cell reference (e.g. -Value(A1) becomes simply A1) and see which cell breaks the sum function. Once you find that cell you can wrap whatever formula is in that cell in the value function to force it to store the numeric value.
I understand the basic use of the vlookup with wildcard but I'm running into a problem lately.
I need to lookup a value that contained in a cell as a part of string. In the below Sample I look up colA in the colC, with should be found, then return the values in col D into col B.
I use =VLOOKUP("*"&A1&"*",C$1:D$2,2,0), and it only works for B1.
Why do B2 & B3 don't work out the same way? Any solution?
Sample:
As per your investigation and comment by Axel, VLOOKUP doesn't work with values over 255 characters in length. A workaround is use an array formula with the SEARCH function which handles much longer values. Double click into cell B1 and paste this formula, then save it by pressing CTRL + SHIFT + ENTER instead of just pressing Enter by itself:
=INDEX($D$1:$D$2,MATCH(TRUE,ISNUMBER(SEARCH(A1&",",$C$1:$C$2&",")),0))
If you enter it correctly, selecting the cell will show {curly braces} around the formula and it should evaluate to your desired result.
This formula first creates an array searching for the position of A1 in every cell in C1:C2. The array will consist of numbers (when A1 is found) and errors (when A1 is not found).
ISNUMBER then creates an array of TRUE (when A1 is found) and FALSE (when A1 is not found)
MATCH then finds the first TRUE value in the array.
INDEX then returns the corresponding value from the D1:D2.
Edit: The formula now searched for the value in A1 followed by a comma. This ensures that an exact match is made. To also ensure that the formula can match against the last value in any cell in column C, a comma is also added to the end of the values in column C.
I have in Column C2, formula results which I need to perform LEFT on in order to trim the cell formula value
The formula result MUST have one of the following (. OR _ OR -) in answer
If one of the above exists in the cell , then LEFT(C2,FIND("the_variable_in_the_formula_answer),C2)-1)
My VBA isn't the best, but I think I could use
variable = Left(Sheet1.[C2],InStr(Sheet1.[C2],".")-1)
I don't know how to make the .(period) , _(underscore) OR -(hyphen) a variable to look for
Try this formula at row two and fill down the column:
=IFERROR(LEFT(Sheet1!C2, AGGREGATE(15,6,SEARCH({".","-","_"},Sheet1!C2),1)-1), "")
It truncates until the first found of {".","-","_"}. If you want to truncate till the last found, change 15 into 14.
For your additional requirements:
=IF(ISNA(C2), D2,
IFERROR(LEFT(Sheet1!C2,AGGREGATE(15,6,SEARCH({".","-","_"},Sheet1!C2),1)-1),C2))