Searching For Multiple Characters Within Range Of Cells?
Dec 10, 2013
The following code works fine to determine if a particular character occurs within the selected range of cells:
Code:
Sub CheckIfCharacterIncluded()
For Each MyCell In Selection
If InStr(MyCell.Formula, "#") Then
MsgBox ("The " & "#" & " character was found in cell: " & MyCell.Address & " at position " & InStr(MyCell.Formula, "#"))
End If
Next
End Sub
However, I would like to extend this functionality to check for multiple characters, using some sort of array that contains all the characters I want to check for e.g. "#","*","£" and so on, without having to repeat the above code for each character for which I need to check.
View 2 Replies
ADVERTISEMENT
Jun 25, 2012
Column A & B has a list of Supplier Part numbers and Buyer Part numbers as below.
Supplier P/N
Buyer P/N
HGFYE/12
111111
HYEYDH/14
222222
[Code] ..........
Cell D2 is an open cell that any data can be entered into as a search term. What I am trying to do is search for a Supplier P/N that have the characters "H", "G" or "E" in it, so entering "HGE" into cell D2 would display the results into columns F & G as below.
Supplier P/N
Buyer P/N
HGFYE/12
111111
HDGTEY/56
333333
I can easily do a formula for 1 character or a string of characters.
To complicate it further, if the search term has in this example has "YFF", I would like the same formula/code to workout that the result in F & G should show this time
Supplier P/N
Buyer P/N
YHDHFF/58
555555
I am using Windows 7 and Excel 2007.
View 2 Replies
View Related
Apr 2, 2014
How can I create a multiple if statements that returns a specific response if the cell is blank?
For instance, =if(K6=[date],"Carry Out"), if(K6=[blank],"Break Out"))).
View 3 Replies
View Related
Apr 19, 2014
The following macro searches for missing combinations. This macro will search the complete list and will return any missing combination from "1, 2, 3, 4" to "7, 8, 9, 10".
I need to make some changes in this macro, so that it will search for missing combinations only within a specified range of cells (and not the whole list). For example (see excel file attached), I would like to place a search within range("G23:J183"), from combination "1, 2, 6, 9" to combination "4, 6, 8, 10". In this case, it should return only 9 missing combinations.
Attached File: Example Find Missing Combinations.xlsm‎
View 2 Replies
View Related
Oct 1, 2009
I have cells that look like the following
PN„¢HWA„¢PN
HWA„¢PN
PN
HCC
PN„¢HWA
HCC„¢HWA
PN„¢HWA
PN
Not the most exciting data, but I need to identify which cells contain the sub string "HWA". Ideally the next column would have that string extracted into it or some kind of indentifier
View 7 Replies
View Related
Nov 26, 2008
I have a number of project files that are maintained on the network.
These files are named "XXXXXX Project Name.XLS".
XXXXXX is the project number. This numbers are unique, so there is only one file per number within the directory. Project names are mostly unique, but sometimes they could be same for a specific site.
We recieve financial data in excel file format from home office. These reports reference only the project numbers, not the name.
I have created an excel program that extracts project numbers and related financial data from the report [from home office].
I would like to create a button or check box next to each project number in my program and link it to the respective file on our network. Once I access the local file on the network I could copy the financial data in its right place.
The problem is opening the file based on project number only, while the file names contain Project Name as well.
So, can I look up a file by only searching for first six characters of the name?
Or can the Hyperlink function work with some sort of wildcard? I can write the formulas to create the hyperlink and then write a macro to look for that file, but I need to be able to find and open the file by looking up only the first six characters.
View 9 Replies
View Related
Nov 8, 2013
I would like to select all cells in column A that begin with the text "SP". Some cells will be contiguous but others will not. For instance in one case, I would like the macro to select cells with the text "SP" which would result in cells A1, A2, A3, A10, A15 being selected. I am working on building a macro that will then do other things to these cells/rows so this is the first step.
The below code will select the first cell with "SP". How would I alter this code to only search Column A and select multiple cells? or totally different code.
Code:
Sub test()
Dim r As RangeSet
r = Cells.Find(what:="SP", LookIn:=xlValues, lookat:=xlWhole)
If Not r Is Nothing Then r.Select
End Sub
View 7 Replies
View Related
Mar 1, 2012
How I can find instances of text strings containing two colon characters separated by any two (arbitrary) characters?
So in other words, "xxxx:xx:xxxx"
If I use :
Code:
SheetName.Cells.Find(What:=":**:", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
...I get a return of any strings containing two colon characters (regardless of the number of characters in-between) - because obviously the asterisk(s) denote any text whatsoever.
How do I specify a finite and exact number of characters between the colons when searching?
View 3 Replies
View Related
Jul 26, 2012
Basically, looking at the range E6:L19 I need to ensure that any data that is entered into any of these cells ends in either H or W, and if it doesn't flags up a warning message (which I am hoping to link in with the Worksheet_SelectionChange event)
I'm managing it for one cell, but not a whole range.
View 4 Replies
View Related
Jul 2, 2014
As I know we can use curly braces if the same cell contains multiple characters. e.g. A1={"XY","WZ","YY"}
How about if multiple cells contains the same characters?
View 1 Replies
View Related
Oct 5, 2008
I have a column of values of peoples initials and I want to cound how many times one persons initials occur in those cells. I can do this if the cells just contain one person i.e. "CH" or "DH" but if the cell has two or more peoples initials i.e. "CD DH" I can't do it as it only matches the exact search criteria.
How can I total the numebr of times a required set of initials appears in a specific column of cells? Not bothered is it requires a macro or a formulae, just can't seem to figure this one out.
View 9 Replies
View Related
Oct 12, 2013
Initially I'm simply copying a data table from a web page using "Ctrl + A" then "Ctrl + C", and then pasting the data straight onto a new worksheet so I can work with it. (After temporarily re-naming the old sheet)
But I keep finding what looks like double-spaces after some of the important text within the Range of cells I'm working with. I need to be able to select & conditional format the values of the text in some columns of the sheet, so need to loose these trailing spaces.
Unfortunately, it's not consistence as to how many spaces trail the text I need. Sometimes it's only one space, sometimes its two spaces ?
So far, I've had mixed success with a recorded "Replace" code but none of the other codes I have found on forum pages either don't work all or seem to give any consistent results. E;g; TRIM, CLEAN
I suspect my problem is, I do not know how to call the code properly, or trying to work with too large a range ?
The start of my code reads:
Code:
Sheets("Data").Select
Sheets("Data").Name = "Old Data"
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Select
ActiveSheet.Name = "Data"
[Code]...
' At the moment I'm using to select the pasted range I want to work on: Range(Range("C46"), Range("C46").SpecialCells(xlLastCell)).Select
This is where I need a code to work on the new Data sheet and remove all the trailing characters.
MsgBox "All data cleaned successfully !", vbInformation + vbOKOnly, "All Done"
View 3 Replies
View Related
May 8, 2012
I need a formula that will search the range D8-D100 to confirm that all cells within that range are either 11 characters in length or blank. I will use it inside of an error message that will look something like this:
=IF(****formula that checks to make sure all of the cells in that range are blank or 11 characters****=TRUE, "", "Please make sure that all cells are 11 digits or blank")
View 7 Replies
View Related
Sep 27, 2009
I am fillin out a spread sheed with a num ber of codes. I want to create a excel formula that will look at the entire column and search for each of the codes. If I have forgotten to add one of the codes into the column I need the formula to let me know.
What I was thinking might work is this...
To look for one of the codes I would do this.
=IF(MATCH("FLA",E5:E36,0)>0,TRUE,FALSE)
This works great if the Value is in there. If it is not in there I get #N/A instead of FALSE. Is there a way to get the MATCH to return another value if it is not found in the range?
Is there an easier way to look for multiple values? So far the only solution I have found is like this
=IF(LEFT(Q19,1)="D",7.5,IF(LEFT(Q19,3)="FLB",7.5,0))
For each value I need to look up I add another IF function. I have about 17 different values I need to look for. This makes for a ugly function but it seems to work.
View 9 Replies
View Related
May 24, 2006
I have been using the VLOOKUP function to search a table of data for a specific value in order to then give me the corresponding data associated with that value. I can do this and it works!!
However, as I am searching for names some people have more than one set of data and the VLOOKUP only finds either the first set of values (if the FALSE command is used for ‘range_lookup’) or the last set of values (if the TRUE command is used for ‘range_lookup’). I have attached a small example:
How can I get all values to be displayed?
I know that this may have been explained horrendously but I have written and re-written this several times and this is the best I can get!
View 9 Replies
View Related
Sep 29, 2006
i am trying to set up an interface through Excel for a database of record also held on excel. I have very very basic VB skills and have no idea what im doing lol but what i would like to do is have a search box and button, something similar as you would find on most websites. I would also like (if possible) for it to search up to 8 workbooks to look for a name or vaule.
View 3 Replies
View Related
May 15, 2009
I have a value X in cell B5 and a Value Y in cell B6, in multiple worksheets
In my userform, i have 2 comboboxes
one holding value ranges for the x coordinaate (eg 0-10, 11-20,21-30)
the other holding values for the y coordinate (eg 0-10, 11-20,21-30)
i want the user to be able to select a range from the x coordinate and the y coordinate...then i want to search thru all the B5 n B6 cels across the worksheets and return those worksheets that match the users input...
is it possible for this to be done?
View 6 Replies
View Related
Jun 28, 2006
It has been a while since working with code and I can't seem to find something similar to this on the site, but I know that this will be a quick fix for someone out there. I am trying to search a range for certain numbers. If they are there I would like for it to pop up a message box. I have narrowed it down to it being the range to which it is giving me an error 13 type mismatch.
If Range("B3:B100") = "8800" Or "9900" Then
MsgBox "You have incorrect...."
Else: MsgBox "Correct"
End If
View 2 Replies
View Related
Aug 12, 2014
I want to search a longer text field for a shorter string that may be within it. However, I want to do this for multiple short strings.
For instance:
PhraseHidden word
Please search the text for the hidden message: Blue
The hidden word, Green, may be at any point
And the word may be different lengths like Yellow
I have a table of the hidden words (Blue, Green, Yellow, Pink)
I know I could use search to find one word, but is there a way to look for multiple words, and return the value of which one it finds? I have many hidden words (and the list is dynamic) so I don't want to just split into multiple searches.
View 5 Replies
View Related
Nov 1, 2009
I have an array of data that i need to find multiple data points in: ...
View 11 Replies
View Related
Mar 26, 2009
Fall - Columns A-G
Spring - Columns I-O
Summer - Columns Q-W
Unduplicated - Columns Y-AD
I am needing to take each student in the Unduplicated section and see which terms they attended. If they attended a specific term, I need to grab a piece of data from that term and put it in over in the undulicated area.
The only way I could think to do this is with three separate searches. This is probably grossly inefficient and so far it has not worked at all. I have posted below the code I am currently using. Again this code is not workin at all.
View 2 Replies
View Related
May 13, 2009
I need to do the following:I have multiple worksheets/ workbooks that hold user info such as address, country, first name,last name, ID,dob, gender, occupation etc
I need to make a search dialog whereby the user is allowed to do this:
1-Search by ID by selecting thru the calendar tool OR
2- search by first and last name. When he clicks search, I need the particular worksheet holding the data to pop up and show the user the data that was requested for.All data in ID column is unique...but for first n last name, i have a few people who have identical names
View 2 Replies
View Related
Feb 2, 2014
i have a spreadsheet that i use for work which has 1 page that contains all the data for the workbook. on other pages i use this data, and tables, to pull information to those pages or other pages which complete my work in a more timely fashion.
that issue i'm having is when i try to look up specific values within the data page tables and there are multiple values.
i need a way to choose different values rather than the "first" value in the instance of a vlookup which only finds the first value.
in the pictures i have picture 1 (vlookup samples) has a section where i can type in the "office" code and it will auto pull "switch name" and "switch clli" via vloookup.
in picture 2 (switches sample) i have created a table, which is on another page as stated above, but if i try to search for the example "LSGT5" it only returns a switch name value of "LFTYINXFDS0" and there is also a value of "LFYTINXFDS1".
there are many more within the table(for this office code alone) but this is just an example of how i need a way to choose the proper one or somehow have a drop down without having to create a bunch of tables for each office itself.
View 6 Replies
View Related
Mar 6, 2007
I am looking to perform a search that will return a match and place it somewhere else, and then search again until its finished the list?
View 9 Replies
View Related
Nov 28, 2012
I'm trying to make a userform to show the results of a search from column A. This code will search the coulmn but when the results show it show's all ranges not just the ones that contain the string
VB:
Private Sub BtnFind_Click() Dim strFind As String
Dim c
Dim rSearch As Range
[Code]......
View 2 Replies
View Related
Apr 10, 2014
Is there a way to search a column range, and do an if/then on it in another cell. Ex) search e25:e37 and if none of the cells have anything in them, then input "--" into cell c14.
View 7 Replies
View Related
Feb 10, 2010
I have vba DATE variable 'FirstDate'; I assign it from a cell with say, 01/12/08; How do I then use that variable to search range of dates, without using the day and searching by only month and year?
Currently, I get the error: "Run-time error '91'; Object variable or With block variable not set" at the point of With Selection.Find(FirstDate).Select
I have been going in circles many times on this type problem: managing clumsily to resolve in the past using: Format(Firstdate,"dd-mm-yy"), text-to-column, NumberFormat etc
View 9 Replies
View Related
Aug 27, 2009
I have two lists. One is a database (Worksheet 2) with a lot of information, and another is the list (worksheet 1) I need to fill up the data for. What I want to do is to search for the names that are in worksheet 1 in worksheet 2, and if there is a match, retrieve the missing data in those rows, and paste it back into worksheet 1. For example:
Worksheet 1: Joe
Tim 23
Matt
Worksheet 2: Alex 45
Joe 23
Mark 47
Tim 44
Matt 24
I basically want it to be able to search for the corresponding name, and then pull the number associated with it.
View 2 Replies
View Related
Jul 8, 2014
The code I currently have allows me to search for one text entry in the column and then copy and paste all those entries into the next worksheet. There are 5 different text entries I'd like it to look for but can't figure out how to do it. I have a work around by using wildcards, but then I have to write another macro to delete out the ones I don't want.
Where is says "DNA - weapons", I'd also like it to allow for "DNA - paternity" and a couple other options.
Here is my current code:
Sub Copy_To_Another_Sheet_1()
Dim FirstAddress As String
Dim myArr As Variant
Dim Rng As Range
Dim Rcount As Long
Dim I As Long
Dim LastCol As String
Application.ScreenUpdating = False
[Code] ....
View 2 Replies
View Related
Jul 20, 2009
I have a problem with excel that I have been trying to solve for the past 5 days! I have 2 tables (one with 500 rows, the other with 15000) that contain information about pipes.
The smaller table, Drift List, is to be used as a reference to fill up the bigger table.
Here is how Drift List looks like:
Size NominalWeight WallThickness APIDriftDiameter AlternateDriftDiam.
5.5 14.00 0.244 4.877 7.625
5.8 14.88 0.253 4.915 ----
...
The other table, Pipe Database, Looks like:
Size NominalWeight WallThickness DriftSize DriftType
5.5 14.00 0.244
...
I have to fill up Drift Size using APIDriftDiameter from the first table, BUT if AlternateDriftDiameter is available, I have to use that instead.
DRIFT TYPE column has to indicate either API or Alternate (Depending on which one I have used).
Here are the two files:
[url]
[url]
View 9 Replies
View Related