VBA Function To Search Partial String And Return Value?

Jan 28, 2014

I'm trying to come up with a VBA function that would return cell values based on another cell value.

I can do this by comparing a range (column of cells) with the cell value to match and then return the value of the cell next to it.

For instance,

The function should search a column for partial text, as follows:

TS ID
PDT ID

TS 1.1
PDT 1

TS 1.2
PDT 2

TS 1.3
PDT 3

TS 2.1
PDT 4

TS 2.2
PDT 5

TS 3.1
PDT 6

TS 3.2
PDT 7

In the above table, the function should for partial text and return string as follows:

TS covered
PDTs

TS 1.1, TS 1.2, TS 1.3
PDT 1, PDT 2, PDT 3

TS 2.1, TS 2.2
PDT 4, PDT 5

TS 3.1, TS 3.2
PDT 6, PDT 7

So basically I am searching for partial text TS 1. and so on

View 4 Replies


ADVERTISEMENT

Search Partial String, Return Value In Next Column, Vba

Feb 13, 2008

I would like to search cells in column D for the partial string, "PIPE," (A full string may look like this: 'PIPE, 24"ODx0.375"WT API-5LX-65,ERW OR SMLS'). Then, if it's there, return the value "LF" in the corresponding cell in column C. If that string isn't found, then I'd like it to return "EA".

I know this seems pretty easy, but there's a small problem. The word "BENT PIPE," could be in Column D, in which case, I would want it to return "EA" instead of "LF".

View 3 Replies View Related

Retrieve Record On Partial String Search

Feb 20, 2008

I have created a Userform for entry data's in a Excel2003 file. I would like to retrieve a complete record (= a row) by searching on a string contained in a cell of this searched record-row. Here an example of a row and I'm searching upon "2041" via an inputbox.

idn° claims Dateréf. Suppl supplier Fax n° PO
1AAA2041 2/01/08200039 BOSCH (RAS) 056/20.26.75 774634

View 9 Replies View Related

Partial String Check In Cell Against Range For Return

Feb 15, 2010

I've posted this query before, not on this forum, but I don't think the replies I've had so far are going to do what I want. Initially I was looking for a formula, but the suggested pile of nested IFs won't work for the number of conditions. I saw a previous post on here for a VBA macro to search for a text value in a cell against the cell contents of a range and it seemed to do at least the first part of what I wanted. I attempted to manipulate it a little to test its applicability for my own nefarious purposes but for the life of me I can't get it working.

This is complicated by the fact that the actual data is commercially confidential, so I can't show you the actual file, but I can fake what I want with two simpler ones. I've attached them to this post. What I want is a fair bit more complex than the other post I found - I want to be able to compare a partial text string from a given cell in a range ('Check Value' in the attached TestBook2 ) against the strings in a range of cells ('Value 1' in TestBook1), and return the corresponding value from 'Test Value' to the corresponding adjacent cell to the tested 'Check Value', with an order of precedence, for example...

Testbook2 contains an entry in C5 of 'a, e, h, z, x, y'. Testbook1 shows that the return for a, b, c, or d is 'moo', for e, f, or g is 'steve' and for g through q is 'fred', all others being no returned value. Moo>steve>fred, so I want the corresponding 'moo, steve. fred or <blank>' cell to contain 'moo'. Conversely, C6 contains 't, u, z' and therefore shouldn't have a value in 'moo, steve, fred or <blank>'. C12 contains 'f, z, s, y, u' and C15 'i, x, z, s', and therefore should display 'steve' and 'fred' respectively.

View 3 Replies View Related

Lookup Partial String To Return Data From Corresponding Column

Mar 22, 2007

I have a simple lists containing two columns. One column contains a five digit number and the other a vendor name. The vendor name in most cases is two to four words. I am wanting to type in a partial string of the vendor name and it return to me the 5 digit 'vendor' number.

Col A Col B
20567 3M Electrical, Inc.

I want to type in '3m' or '3M' or 'electrical' or 'ELECTRI' and it return the 20567. The other part of this is that there may be two rows with the same info in which I would need to see both...

Col A Col B
20567 3M Electrical, Inc.
21789 3M Tape Division

Is this possible with standard lookup features in Excel or does someone have a VbScript or macro that will accomplish this?

View 9 Replies View Related

Partial Text Lookup In Text String And Return

Mar 15, 2007

Cell H1 has a variable string of references for eg
"FI570783AQ3516346EQ3516346FXVB123456"

I want to return the reference beginiing with "FXVA" so it would ignore the rest and only return FXVB123456 - this should always be 10 characters.

Just to add another complication to the mix, there may be 2 "FXVA" references in the string and i want to get both (these can be in the same string so FXVB123456FXEL123456 - but this might not happen regularly.

View 9 Replies View Related

Search A String And Return The Full File Name And Path

May 27, 2014

In the attached excel, I will be putting a string (Which will be a result of another formula) and there will be a table in column A & B(Length of the table will vary).

What I need is a formula to search entire column B and get the file names which is having that string and also the corresponding path

Table E6 to F9 contains the desired result (The result wont be more than 3 at any point of time

Search.xlsx

View 3 Replies View Related

Search For Text Within A String, Lookup And Then Return Item

Sep 30, 2009

I have a spreadsheet!

I have two sheets, one of which contains film names and the other contains our tag structure for our website (which is a list of tags, their keywords and the primary parent channel they live under).

What I am trying to do is search the film titles and if any of the words match either the tag name or keywords then return the relevant channel.

Example:

Sheet 1 - Films
How To Apply Bridal Makeup
How To Fight A Donkey
How To Write Excel Formulae

Sheet 2 - Tags
Channel / Tag / Keywords
Tech - Microsoft - windows vista xp word excel
Tech - Computers - internet pc
Tech - MP3 Players - iPod Zune

So, for film 3 on Sheet 1 it would recognise the word Excel in the keyword list and return the channel Tech.

View 12 Replies View Related

Search Text String And Return Value Based On Multiple Criteria?

Apr 8, 2013

Here is an example of the data I get each day Letter order granting Sabine Pass Liquefaction, LLC's et al 4/16/12 request to add an alternate water source etc under CP11-72.Letter order granting Cameron LNG, LLC?s 4/5/13 filing of a request to introduce natural gas or process fluids into the BOG Liquefaction Project under CP12-15.Letter order accepting NorthWestern Corporation's 8/7/12 submittal of revisions to its transmission planning process to comply with the Commission's June 8, 2012 Order under ER11-2932.Letter order approving Public Service Company of New Mexico's 12/7/12 filing of a joint Offer of Settlement with Navopache Electric Cooperative, Inc under ER11-4534 et al. How can I set up my spreadsheet and what formulas can I use to search and return a value for each text string based on the attached table (column B)?

E3a7qta.png

View 1 Replies View Related

Excel Has No String Search Function With Instance Choice?

Nov 4, 2012

I don't have to keep using the ridiculous Substitute() work-around when I need to grab cell text after the nth instance of a character. In doing data cleanup I'm constantly having to grab text between, say, the 4th space character and the 6th one. Since Search() doesn't have an instance parameter, I end up having to use the 'Substitute trick', since it's the only string function that does have one.

See below for a typical example of the convoluted formula I need, and another example of it if Search only had 'instance' available. Simplifies the formula quite a bit.

*Typical real example, here to find the word between the 4th and 5th spaces in A1:

"=MID(A1, SEARCH("^", SUBSTITUTE(A1, " ", "^", 4)),
SEARCH("^", SUBSTITUTE(A1, " ", "^", 5))-SEARCH("^", SUBSTITUTE(A1, " ", "^", 4)))

Fantasy, 'fixed' example after MS adds instance:
=MID(a1, SEARCH(" ", a1, [instance #4]), SEARCH(" ", a1, [instance # 5])-SEARCH(" ", a1, [instance # 4]))

View 9 Replies View Related

Search For A Phrase In Column - Function Return Error

Feb 18, 2013

I am trying to search for a phrase in a particular column but the excel search function is returning !Value as an error...

Both fields are text so nit sure what is wrong here.

I have a list of cities that i want to cross reference across a cloumn of notes on another sheet. So, I really want to search for the city (Sheet1 Cell A1) in Notes Sheet2 Cell A1) and I want to return it in Sheet1 Cell B1 Whether it exisits in the notes. I then want to copy this down my list of cities in Sheet1 Column a.

View 5 Replies View Related

VB Function To Return CODE128b Barcode Font String ()

Feb 26, 2007

I found what looks to be a BASIC or perhaps early C form of code that will do exactly this, however I am finding it out of my grasp to 'convert' the below code over to VB for Excel, and I was hoping someone would be able to piece it together for me. Code128B is a barcode font that requires a 'computed' start and end bit, as well as a checksum character(s) in order for the barcode to be valid and readable by barcode scanners. This code (in whatever it is written, I don't really know), is said to do just that. Code:..................

View 4 Replies View Related

Function To Process String Input And Return Integer

Oct 2, 2006

i did some VBA quite a while back, and picking it up again.

I'm trying to get a function to read in a string, and return a value based on the string value.


Public Function value(ItemType As String) As Integer
If ItemType = " Upper" Then
value = 40
ElseIf ItemType = "Middle" Then
value = 50
ElseIf ItemType = "Lower" Then
value = 25
End If
End Function

When i tried using it at the Cell level, it keep giving error i.e. Invalid Name Error

View 9 Replies View Related

Excel 2007 :: Search Box Function - Return Value / Text Not Location

May 15, 2014

I need code for a search box function, that returns the information recorded in a cell for example, "Barcelona" or "London" etc), instead of the location of the cells.

I will need to narrow it down to search only the information in the following columns:

Sheet2
I2:J10932

I am totally new to VBA coding and have stumbled my way through a few things, but everything I have searched for so far has had at least one error when transposing to Excel.

I am running Excel 2007.

View 3 Replies View Related

Search For Multiple Text Strings In A Cell - Return One Of Multiple Corresponding But Different String

Mar 11, 2014

I have a spreadsheet with 1,000 rows of data.

Each Cell in Column A has a different long text string.

I need to see which (if any) of 10 specific small text strings exist within each long text string. Depending on which small text string is found I want to return a 3 digit code. If no small text string is found I want to return "Not Found"

E.g.:
- Cell A2 contains "randomtext,randomtext,APPLE,randomntext"
- I want to see if Cell A2 contains any of the words APPLE, ORANGE, CARROT.
- I want to return "APP", "ORG", "CAR" or "Not Found"

Q: What is the most elegant way to accomplish this within a single formula that I could paste into each cell in Column B?

View 2 Replies View Related

VBA Find Partial String In Array And Output Found String Array Value?

Mar 31, 2014

I am trying to do a sort of index match thing using VBA. What I am attempting to do is to use the prefix of a long number and try to find that exact prefix in a string array, and output that string array value. So this is what I have so far as a test:

[Code].....

So I can match the text exactly so if I put PREFIXB in cell A1 in this example, i will get the msg box saying "YES", but if I make it PREFIXB1231k4j3jj1kj32cj, it will display "NO". I want to get it so that PREFIXB will be displayed in the cell that I put the formula in. So if A1 = "PREFIX1AAA100CF" and cell B1 = "=ABC(A1)", cell B1 will display "PREFIX1AAA".

Now the thing is that these prefixes can have different lengths, but will never encompass the exact prefix of another. So if I had a prefix of: PRE1AB, I won't have a prefix of PRE1A.

View 2 Replies View Related

Select Based On Partial String Then Delete Based On Full String?

Jun 13, 2013

Working with a scheduling report and trying ultimately to get it down to a line item report with the associate information and their earliest start and latest end for the week. Already made a lot of fixes to the formatting involving junking empty cells and trash data, but running into a road block on some of the trash data.

Here is the format of the report at this point. Names have been changed to protect the innocent.

Agent: 2366 Bacon, Kevin

Date
Start
End

[Code].....

So what I need is something that will iterate through the report...such as an while and find the cells in column A that start with "Agent:" It needs to compare that cell to a stored value to see if this "Agent:" is a repeat. If it is then it needs to delete that row and the next one and shift up. If it is not then it overwrites this "Agent:" with the previous one in the stored value and continues the while.

I know what I want to do...but not shure on the code cause I am not great at VBA.

Oh...if it matters probably need to allow for about 10k line items to iterate through...right now report is at 6k...but allow room to grow.

View 6 Replies View Related

Look Up With Partial Text Search

Apr 16, 2009

I am looking for a lookup to look for text within Column A that matches text in column D and brings the word in that is in column E ...

View 9 Replies View Related

Partial Word Search

Jul 25, 2006

Is there a command out there that i can use to search a cell or textbox for part of a word, eg. my word being phone, and for it to look at cellphone and recognize it.

View 4 Replies View Related

Partial String Vlookup

Nov 25, 2008

I have two columns Cust. Phone and State. The Cust. Phone column has the full 10 digit number. Some with the preceeding 1 and some without. The vlookup will sit in the State column. I am trying to perform a lookup using the area code.

I have tried the following but always recieve #N/A.

=IF(LEFT(CELL("contents",A2))="1",VLOOKUP(MID(A2,2,3),D2:E8,2,FALSE),VLOOKUP(LEFT(CELL("contents",A2),3),D2:E8,2,FALSE))

It makes sense if I walk through it but fails to work.

I am trying to use the HTML maker to upload an example but I'm running into problems. I'll update ASAP.

View 9 Replies View Related

Partial String Lookup

Sep 5, 2007

I need to do a lookup in a column for part of a string and return the adjacent value in a different column. Works fine using VLOOKUP as seen in the following example except that the return value is being truncated.

Lookup range in column A:
A001,A002
A003,A004
A005,A006

I need to find A001 and return the value in column I of the same row. I am currently using {VLOOKUP("A001", LEFT(A1:I500, 4), 9, 0)} This does work entered as an array formula but it is only returning the left 4 characters of the column I value. I need to lookup the left 4 characters in the lookup range but return all the characters in the return range.

View 2 Replies View Related

VBA - Search Worksheet Tabs By Partial Name

Jun 29, 2011

I have a spreadsheet that is sent to me monthly. Here is the issue:

Each workbook contains multiple tabs. The position of those tabs may be different positions when received.

The part of each tab's naming convention does not change, while the rest of the tabs' name contains random information.

My question: Is it possible to to search/find the tab based on part of the name?

example: Name on tab:
Pivot Table Data June 2011

Search for: Pivot

View 3 Replies View Related

VBA Partial String - Put First 4 Characters Of One Cell Into Another

Jan 30, 2013

I haven't had the need to work with partial strings till now and having difficulty finding the right context in other threads. I need to put the first 4 characters of one cell into another cell. The line in the below code with the comment is the one I need. It's the only one where I need only part of what is in the cell.

It should be = the first four characters of cells(zRow, "A")

Code:
Dim LastRow As Long
Dim zRow As Long
Dim cRow as Long

LastRow = Sheets("Datasheet").Range("N65536").End(xlUp).Row
zRow = 1
cRow = 2

[Code] ......

View 1 Replies View Related

VBA Partial String Extraction From Variable?

Feb 12, 2013

I have a comment that I'm putting into a variable for the purpose of obtaining the persons name.

Cell C3 (in this example) just contains their employee number, but it's comment contains...

Tech ID: 123456
Name: John Doe

The Tech ID is variable from 3 chars to 6 chars and obviously the name is size is also variable. The end result will be a variable with just the persons first and last name extracted from the comment.

Code:
Dim mycmt As String
Dim techname As String
mycmt = Sheets("tech").Cells(3, "C").Comment.Text
techname = Right(mycmt, BIG-OLE-BALL-OF-CONFUSION)
MsgBox techname

My 2nd question. This is the 3rd time in recent days that I've needed a partial string and Mid, Left, Right, Len, Find just boggles my mind.

View 6 Replies View Related

Macro For Partial String In Text

Oct 21, 2008

I want to write an macro where it searches for text in a column, but the text may be a partial string. The text is in column B, with account numbers in column A, like this:

Column A Column B
1100 Jay
1101 Jack
1102 Jackson
1103 Jacksony
1104 Jefferson

For example, I want to search on Jack in column B. In the above example, I want it to find accounts 1101, 1102, and 1103, and to copy that information to another spreadsheet, say, sheet2.

If possible, I'd like it to copy the first account number and name, 1101 Jack, and if that's not what the user wants, they click next and they see 102 Jackson and so forth.

View 9 Replies View Related

Search Partial Text With In Data Range?

Dec 18, 2013

I am trying to search partial txt with in data range.

View 4 Replies View Related

Search For File With Wildcards And Partial Filename

Nov 21, 2008

I am trying to set a file name as a string to use it as an attachment. The user inputs a number into a textbox. That number is used to locate the file in location. But the file name is different with each file. So im trying to do something like

"C:Desktop*TextBox1*.docx"

Whereas the actual file name is "C:DesktopMCJC RFI 1 MISSING ROOM NUMBERS.docx"

The location "C:Desktop" will always remain the same as will ".docx". I have everything else working just fine.

View 8 Replies View Related

Formula To Match Partial Text String?

Jun 3, 2014

I'm working on a formula to make it enable a part of the text then return the best possible match. Below is my formula

=MATCH("*"&$A11&"*",'[Customer Master List - 05.30.xlsx]Export Worksheet'!$B$82:$B$1298,0)

However, it works with some text but won't work for some.

For example, I have this text CARE-A-LOT, INC and in the master sheet there is a similar text like this CARE-A-LOT. I want it to return CARE-A-LOT as this the best match possible.

View 2 Replies View Related

Get Partial String From Active WorkBook.Path

Sep 30, 2009

I tend to stumble when trying to pull certain characters from strings, not sure how to stop and start my search.

View 4 Replies View Related

Delete Row Based On Partial String Criteria

Dec 10, 2009

I have 2 columns A and B. The data is in column B.

What I'm trying to do is delete entire rows from my current selection if they do not begin with mailto:

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved