I am looking for an excel formula that either counts or returns true if the cell contains a word pattern (basically wanted to know if any such cell exists), but formula shall recognize a cell as valid only if
Requirement 1 : complete word pattern to be present and as a single word in the cell being checked(Eg: if ab12 is pattern, ab123 is not valid, only ab12 is valid)
Requirement 2 : the matching word can be either in the beginning or end or in middle of the cell being checked
Requirement 3 : The input cell(s) being checked may contain this matching word and can contain prefix/suffix as " "(space) or a line break/feed . Hence, the formula shall identify this cell as valid for both these scenarios
Example word pattern : ab-1_cd_1234
At the moment I have tried both formulas below (also tried with " ","*","~" in the criteria) but didnt work :
Formula 1 : =ISNUMBER(SEARCH(A2,B2))
Here, A2 is the pattern, B2 is the input to verify and will be verified in full B column
Formula 2 : =COUNTIF($B:$B, "* " &A2& " *")
Here, B:B is the input column and A2 is the pattern
Also, I got to know that there is a wildcard in word < and > that defines a word beginning and end, but the same didnt work in excel.
So, it would be great if I can get any formula that works in excel
You can try following formula:
=SUMPRODUCT(--($A$2=FILTERXML("<a><b>" & SUBSTITUTE(SUBSTITUTE(B2,CHAR(10),"</b><b>")," ","</b><b>") & "</b></a>","//b")))>0
Edit
To solve problem with empty strings:
=SUMPRODUCT(--($A$2 & "#"=FILTERXML("<a><b>" & SUBSTITUTE(SUBSTITUTE(B2,CHAR(10),"#</b><b>")," ","#</b><b>") & "#</b></a>","//b")))>0
Edit 2:
To count number of cells which contains pattern you can use array formula:
=SUMPRODUCT(--(IFERROR(SEARCH(" " & A2 & " "," " & SUBSTITUTE($B$2:$B$10,CHAR(10)," ") & " "),0)>0))
Array formula after editing is confirmed by pressing ctrl + shift + enter
Please try this formula, where A3 is a text to be searched and the text to be found is in A1.
=IF(ISERROR(FIND(" "&$A$1&" "," "&SUBSTITUTE(A3,CHAR(10)," ")&" ")),"",TRUE)
Related
I am looking for help with a formula in Excel to find a specific number in a string of numbers.
Our accounting system pulls a report showing numbers from 1 to 10 and each line can have numerous numbers listed in the cell, each separated with a ";".
What I want to do is create a formula that allows me to simply look for the number in columns O to X (row 3) and fill that number in the corresponding cell.
So starting from row 4, I would like to create a formula that finds each number in the string and simply fills in the one I am looking for in each cell, for example I would like the end result to look like the below example:
If the number doesn't appear then that column is left blank, but if it is found it simply adds itself into the corresponding column.
Hopefully someone out there can help me with this.
Regards;
Greg
formula in B3
in German:
=WENN(ISTFEHLER(FINDEN(";" & B$2 & ";"; ";" & $A3 & ";"));"";B$2)
in English:
=IF(ISERROR(FIND(";" & B$2 & ";" , ";" & $A3 & ";")),"",B$2)
Try this in cell O4:
=IF(NOT(ISERROR(SEARCH(O$3,$N4,1))),O$3,"")
Notes:
Assumes your numbers 1 to 10 are in row 3 (i.e O3:X3)
I have always had a problem importing phone numbers from CSV files into Outlook. Now I am working with Excel to clean up the telephone fields which should be in +1 545 254-2351 format.
I need to first test to see if the cell is empty containing the telephone number and if false to convert the contents of the cell to TEXT. I have written the following formula to no avail.
=IFS(ISBLANK(A5),"",ISTEXT(A5),A5,TEXT(A5,0))
In theory if A5 is blank it will return a blank cell. If it is not blank then if A5 is TEXT the result will be just A5. If it is not text i.e. a number, then it converts a5 to text.
This does not work. Can someone help me with this?
If we assume that A5 can contain either:
Text like: +1 545 254-2351
blank
Number like: 15452542351
Then in B5 enter:
=IF(ISBLANK(A5),"",IF(ISTEXT(A5),A5,("+" & LEFT(TEXT(A5,"#"),1) & " ") & MID(TEXT(A5,"#"),2,3) & " " & MID(TEXT(A5,"#"),5,3) & "-" & RIGHT(TEXT(A5,"#"),4)))
I have situation like his
Text Number Letter Color
empty 1 A Blue
I want to put vales from Number, Letter and Color in Text field to look like this:
Text Number Letter Color
Number is: 1 1 A Blue
Letter is: A
Color is: Blue
How to put all this value from other fields with some extra text into one field in excel?
use
="Number is: " & B2 & char(10) & "Letter is: " & C2 & Char(10) & "Color is: " & D2
Make sure WrapText is enabled.
If you have TEXTJOIN then you can use this array:
=TEXTJOIN(CHAR(10),,$B$1:$D$1 & " is: " & B2:D2)
Being an array formula it must be confirmed with Ctrl-Shift-Enter instead of Enter when Exiting edit mode.
TEXTJOIN was introduced with Office 365 Excel
To do in separate cells put this in the first cell:
=INDEX($B$1:$D$1,,ROW(1:1)) & " is: " & INDEX($B$2:$D$2,,ROW(1:1))
And copy down.
Excel Method
Use the formula =INDEX($C$1:$E$1,,ROW(1:1)) & " is: " & INDEX($C$2:$E$2,,ROW(1:1)) INSIDE EACH Cell you want it to copy the data from.
GOOGLE SHEET METHOD
You can use the formula: ={{"Number is: ", C2}; {"Letter is: ", D2}; {"Color is: ", E2}} In any 1 cell. Giving you this.
I'm new to stack overflow so I apologize if this is a horrendously stupid question. I am wondering if there is a function or way to code a function in excel that will combine a column of cells with plain text and convert them into one cell with the text on a single line? Specifically I want to convert a column of random numbers into a single line of text and insert SPACE+AND+SPACE between them.
Ex.
15133484
12345188
12345888
to
15133484 AND 12345188 AND 12345888
Currently I am copying and pasting all this information into google and then into Word and using find/replace and it is taking forever everytime. If it is possible to just get Excel to do this for me that would be amazing.
Thanks!
If you have Office 365 Excel use TEXTJOIN():
=TEXTJOIN(" AND ",TRUE,A:A)
otherwise one would have to use:
=A1 & " AND " & A2 & " AND " & A3
Or one can use a helper column, B1 put:
=A1
put this in B2 and copy down:
=IF(A2<>"",B1 & " AND " & A2,B1)
And grab the last cell in column B.
A little late, but still:
Reference here
Step 1:
=concatenate(transpose(rngBeg:rngEnd & " AND "))
Step 2:
highlight the transpose statement and then press F9, which substitutes the actual values for the formula.
Step 3:
Remove the curly braces, { }, from the formula. The cell will display the range of reference cells combined with whatever separator chosen after the ampersand sign.
Not a "live" formula, but still far easier than manually concatenating a range of values.
Press ALT+F11 to open Microsoft Visual Basic for Applications,
Insert-> Module
Paste this:
Function Combine(WorkRng As Range, Optional Sign As String = " AND ") As String
Dim Rng As Range
Dim OutStr As String
For Each Rng In WorkRng
If Rng.Text <> "," Then
OutStr = OutStr & Rng.Text & Sign
End If
Next
Combine = Left(OutStr, Len(OutStr) - 5)
End Function
In any cell type =Combine(Range)
i.e.
=Combine(A1:A500)
use concat function if you can add an additional column in the excel like this:
=CONCAT(D3:E5)
Attached sample image with input, additional column, output and formula
I assume you want to merge the data in the 3 cells into a single cell with a space between the 3 data set.
If that is the case then you can do it simply by using the Concatenate function in excel.
In the above example, you have data in Cells A1, A2 & A3.
Cell C1 has the merged data. As you can see, we have used CONCATENATE Function.
The space has been defined in Double quotes. So if you need a Hyphen (-), you can put that in Double Quotes with space “ - ” and it will display the result with Sanjay - Singh - Question
Hope this helps.
The only way my client can provide me these addresses is with the location is in one row: Location Name, street address, city.....and then the row below it contains the zip code. This repeats for 1600 lines.
I, of course, need all the info on one line. Is there a genius out there than knows how to make short work of putting the zip code on the line above it?
If you have address in columns A, B and C in the first row and zip code in column A in second row, try the below formula,
=INDEX(A:A,ROW()*2-1,1)&" " &INDEX(B:B,ROW()*2-1,1)& " " & INDEX(C:C,ROW()*2-1,1)& " " &INDEX(A:A,ROW()*2,1)
If you are starting from some other row other than row 1, you may have to modify the formula a little bit. Hope this helps.
Use a formula to combine your columns.
Here we have some test data.
In column D, specify a formula such as =A1 & ", " & B1 & " " & C1
If you're no familiar with formulas, just use "=" to denote the start of one, and then use "&" to concatenate your values.
As for as implementing this on a multi-row basis, you can easily do so. Once you drag your formula down, it'll auto increment the column names unless you specifically specified it not to. I won't get into that right now though.
So what I would do is just add an IF statement in your formula to account for those rows which are not intended to be used. Using a formula such as this: =IF(B1="", "", A1 & ", " & B1 & " " & A2), I can get the following results.