I ran into something unexpected after creating a spreadsheet.
I currently have a formula that lookups the text "A Term" within a cell.
=IF(FIND("A Term",P2),"A Term",0)
I need this formula to also look for the text "Full Term".
In other words, I need it to say "A Term" if either the text "A Term" or "Full Term" is located within the cell, P2.
Any help is appreciated.
The answer is (literally) in your question: an OR statement:
=IF(OR(ISNUMBER(FIND("A Term",P2)),ISNUMBER(FIND("Full Term",P2))),"A Term",0)
Note that FIND is case sensitive, if you want a case insensitive search, use SEARCH
=IF(OR(ISNUMBER(SEARCH("A Term",P2)),ISNUMBER(SEARCH("Full Term",P2))),"A Term",0)
Related
I have a list of addresses, such as this:
Lake Havasu, Lake Havasu City, Arizona.
St. Johns River, Palatka, Florida.
Tennessee River, Knoxville, Tennessee.
I would like to extract the State from these addresses and then have a column showing the abbreviated State name (AZ, FL, TN etc.).
I have a table that has the States with their abbreviation and once I extract the State, doing a simple INDEX MATCH to get the abbreviation is easy. I don't want to use text-to-columns because this file will constantly have values added to it and it would be much easier to just have a formula that does the extraction for me.
The ways I've tried to approach this that have failed so far are:
Some kind of SEARCH() function that looks at the full State list and tries to find a value that exists in the cell
A MID or RIGHT approach to only capture the last section but I can't work out how to have FIND only look for the second ", "
A version of INDEX MATCH but that fails because I can't find a good way to search or find the values as per approach (1)
Any help would be appreciated!
Please try this formula, where A2 is the original text.
=FILTERXML("<data><a>" & SUBSTITUTE(A2,", ","</a><a>") & "</a></data>","data/a[3]")
An alternative would be to look for the 2nd comma as shown below. Note that the "50" in the formula is an irrelevant number required by the MID() function. It shouldn't be smaller than the number of characters you need to return, however.
Char(160) is a character that wouldn't (shouldn't) naturally occur in your text, as it might if the text comes from a UNIX database. You can replace it with another one that fits the description.
=TRIM(MID(A2, FIND(CHAR(160),SUBSTITUTE(A2,",",CHAR(160),2)) + 1,50))
The following variation of the above would remove the final period. It will fail if there is anything following the period, such as an unwanted blank. That could be accommodated within the formula as well but it would be easier to treat the original data, if that is an option for you.
=TRIM(MID(LEFT(A2, LEN(A2)-1), FIND(CHAR(160),SUBSTITUTE(A2,",",CHAR(160),2)) + 1,50))
To find the abbreviation I would recommend to use VLOOKUP rather than INDEX/MATCH.
Use this (screenshot refers):
=MID(MID(B3,1,LEN(B3)-1),SEARCH(",",B3,SEARCH(",",B3,1)+1)+3,LEN(B3))
I Have a cell A2 in Excel with:
BenQ ZOWIE XL2411P 24" LED 144Hz e-Sports
I want extract phrases and transform them.
If text contain "LED" so write "Display: LED | ". If text contain "144Hz" so write "Refresh Rate: 144Hz | ". How can I do it with one function in one cell?
Thanks
You can use nested SUBSTITUTE functions for this
eg, if your text is in A1, then use
=SUBSTITUTE(SUBSTITUTE(A1,"LED","Display: LED"),"144Hz","Refresh Rate: 144Hz")
Note that this will find the search terms imbeded within other terms. Eg if you already had ...Display: LED... in your string, this will return ...Display: Display: LED...
I'm not sure I understand what you mean by "I want extract phrases and transform them." But I would think you could do something similar to displaying the result by using the ampersand. From the examples you might be able to use
IF(ISNUMBER(SEARCH("LED",A2)),"Display: LED |")&" "&IF(ISNUMBER(SEARCH("144Hz",A2)),"Refresh Rate: 144Hz |")
Though I can't verify that will work right now.
https://www.techwalla.com/articles/how-to-create-multiple-formulas-for-the-same-space-in-excel
https://www.excel-easy.com/examples/contains-specific-text.html
I'm trying to clean up job title data using the formula below:
=IF(OR(ISNUMBER(SEARCH({"admin","reception","account","finance","HR","public","sales","customer","creative","IT","human"},A1))),"",A1)
It should work by eliminating job titles with any of the texts specified in the quotes above. However, I've encountered an issue where it doesn't. In a case where the job title is Quantity Surveyor, the title contains none of the specified texts but Excel seems to reflect it as such. What am I not doing right here?
Quantity Surveyor Example
To extract the information you are looking for, this is the formula you want to use:
=IFERROR(IF(OR(ISNUMBER(SEARCH({"admin","reception","account","finance","HR","public","sales","customer","creative","human"},A1)),NOT(SEARCH("Quantity",A1))),"",A1),"")
Using countif you don't need to check for errors if they occur:
=IF(OR(COUNTIF(A1,{"admin","reception","account","finance","HR","public","sales","customer","creative","human"}))+COUNTIF(A1,"<>Quantity"),"",A1)
Select the part of formula of search, and then press F9. You will find the match result of 6, where it has original value of 'IT', it means Quantity, has IT.
I really donot know why there is negative vote as not useful.
Here is the formula to solve your problem
=IFERROR(LOOKUP(1,0/FIND({"admin","reception","account","finance","HR","public","sales","customer","creative","IT","human"},A1)),A1)
Of course, it is better to define a range instead of hard code {}, like below
=IFERROR(LOOKUP(1,0/FIND($J$2:$J$7,A2),$K$2:$K$7),A2)
need a little help with IF & OR to formulate response base on value in Cell M8, I believe i'm very close to what I want but I don't understand the error it.
Ultimately I want the formula to perform the following function
If Cell M8 = No Access, it will display No Access
But if M8 have a value above 61, it'll display "Exceeded Pre-Determined Level",
and if value is between 43 to 61,it'll display "Exceeded Alert Level"
=IF(M8="No Access","No Access", (ABS(M8)>=61,"Exceeded Pre-Determined Level" OR(ABS(M8)>=43,"Exceeded Alert Level")))
Try like this:
=IF(M8="No Access";M8;
IF(M8>=61;"Ex eed Pre-Determined Level";
IF(AND(M8>43;M8<61);"Exceed Alert Level";
"I guess it Is ok")))
You may need to change the ; to ,, depending on your formula separator.
Whenever you write complicated Excel formulas, it is always good to write them on a few lines, using ALT + Enter on the formula bar.
Solution just using another If:
=IF(M8="No Access";"No Access";IF(ABS(M8)>=61;"Exceeded Pre-Determined Level";IF(ABS(M8)>=43;"Exceeded Alert Level";"")))
In this case you don t need an "Or", "Or" would give you the same result for the 2 different logic tests.
I suggest you using absolute references in this case as:
(With note that you have tried absolute numbers)
=IF($M$8="No Access",$M$8,
IF(ABS($M$8)>=61,"Exceeded Pre-Determined Level",
IF(AND(ABS($M$8)>=43,ABS($M$8)<=61), "Exceeded Alert Level",
"None of them")))
And your system separating character may , or ;.
Breaking formula with Alt + Enter
Is it possible to search for a specific text in cells and move it?
For example: "ABCD [45] - City"
Result: "[45] ABCD - City"
Of course you can.
It is possible by code, formulae or search/replace (using regex).
In your example you search for something in square brackets and put this finding in front.
A regular expression search here will be
search for: (.*)(\[.*\] )(.*)
replace by: $2$1$3
Don't forget to tick the option "regular expression"
[Everything to search and replace with this is explained in online help: F1]
If you want code or formulae to have the task accomplished: ask more specific!