Find Out What Row Or Cell Address That The VLOOKUP Found The Data
Dec 18, 2008
When I use VLOOKUP formula within a VBA routine ex:
For LoopCounter = 1 to LastRow
With Worksheets("0MATERIAL")
.Cells(RowCounter, 5).FormulaR1C1 = "VLOOKUP(RC[-2],'0MAT_UNIT'!R1C1:R65520C12,4,FALSE)"
End With
RowCounter = RowCounter + 1
Next LoopCounter
How can I find out what row or cell address that the VLOOKUP found the data? The above code works perfectly but the problem is I need data from that same row in columns 4-11. I replicated the .Cells line above and made each one a VLOOKUP (for column 4, 5, 6, etc...) but this kills the performance. I have around 32,000 rows in sheet 0MATERIAL and around 50,000 rows within sheet 0MAT_UNIT
View 9 Replies
ADVERTISEMENT
Jun 21, 2013
I am using VLOOKUP to find the size of a cam to be installed in a tablet press, based on the product code it will be running.
The array has two columns: (W) Product Code, (X) Cam Size.
Array: W4:X437
The user selects the Product Code from a drop-down list in cell E5.
The resulting Cam Size is displayed in cell E7. The VLOOKUP works fine.
=IFERROR(VLOOKUP(E5,W4:X437,2,FALSE),"")
Occasionally, the cam size has to be updated. The user would then select a new cam size from a drop-down list in cell E9.
I have a "Update Cam Size" command button.
What I need to happen is for the value in E9 to replace the value in the array that is displayed in E7. Obviously, I have to know the location of the cell in the array, but I can't figure that part out. I've tried ADDRESS and MATCH functions, but it comes back with "#N/A" Value not available error.
=ADDRESS(MATCH(E7,W4:X437,0),2)
View 3 Replies
View Related
Aug 29, 2007
I've got a workbook with a sheet for every month containing clients serviced in the specific month. I've found thread to complie a search box, which is great, but it gives me the value of the search. I need the search to take me to the sheet where the adress of the result is. Please see below the code for the search box i used.
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim cl As Range, rng As Range
For Each ws In ActiveWorkbook.Worksheets
Set rng = ws.UsedRange
With rng
Set cl = .Find(Me.TextBox1.Value, LookIn:=xlValues)
If Not cl Is Nothing Then
Label1().Caption = (cl.Offset.Value)
End If
End With
Next ws
End Sub
View 9 Replies
View Related
Sep 20, 2007
I want to find the subtotal amount on one worksheet, which is two columns over from the text, "Sub Total:" on the same row. The subtotal line floats up and down each week. Once I can find the subtotal I want to populate another worksheet with the data.
View 5 Replies
View Related
Feb 12, 2013
Below is the code to look in a specified sheet and find the values in the row where the combobox value is found. These values that populate into the Listbox when a Combobox value has been selected, are in the same row as the Combobox value, but offset 20 - 29 columns.
All is good in this section of code.
The Listbox has 3 coulumns. It is populated as follows:
1st column is the header in Row 1 of the the columns
2nd column is the actual numerical values(minus another value offset 80 columns) in the combobox specified row, and
3rd column is the actual numerical value address in the combobox row.
Code:
Private Sub ComboBox1_Click()
Application.ScreenUpdating = False
If Me.ComboBox1.Value <> "" Then
Me.ListBox1.Clear
' On Error Resume Next
[Code] .......
The next code runs thwn the user double clicks a Listbox value. It basically enters the Combobox value and Listbox value to a sheet. All is good here, with the exception to placing the Listbox item address to the specified sheet cell.
For some reason i ALWAYS obtain the LAST possible address of the range of values (i = 20 - 29), instead of the actual item selected in the listbox.
Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With Sheets("DESPATCH")
.Activate
ActiveCell.Value = Me.ComboBox1.Value
[Code] .......
How to rectify this to obtain the correct listbox address ?
View 1 Replies
View Related
Nov 4, 2009
I want to copy some data from internet and paste it in to worksheet location Range A1:A30. the data look like following information.
LocationKuwaitP.O.Box:4819 SafatAddress:ShuwaikhTel:-22253580Fax:-24343645Category:CONSTRUCTION COMPANIES
the above information have following header ie. Location, P.O.Box, Address, Tel, Fax and Category.
every time one of the header inforamtion is missing ie. Address or P.O.Box, Or Fax, due to this problem every time cell address of information aganist header is change. supose in first copy/paste Tel inforamtion is in A15, but second time it may be on A13, and 3rd time it may be on A17 and so on.
I want to make a macro which search header ("Location", "P.O.Box", "Address", "Tel", "Fax", "Category" ) from a Range A1:A30. than down two steps to copy header information (75325412) and paste in fixed cell location C1:C5 (C1=Name, C2=Location, C3: P.O.Box, C4=Address, C5=Tel, C6=Fax, C7=Category) in same sheet. and repeat the steps to copy information aganist header from all header in Range A1:A30.
View 9 Replies
View Related
Apr 5, 2007
DETERMINING ROW NUMBER FOR DATA FOUND WITH VLOOKUP IN VBA
I have a user form with a combobox (called STKCODE) that calls up a vlookup routine to search for this item in a named range on a worksheet and retrieve related data to display on the userform. All this works fine.
What I would like to know is how to easily determine the row number on the worksheet, representing the row the data is stored in, if thats at all possible....
View 9 Replies
View Related
May 18, 2002
Is there a way to get the vlookup function to return the cell address, rather than the value, of the lookup?
View 9 Replies
View Related
May 22, 2014
I am struggling to find a macro which can look at a name in column 'BT' and search it in the address book of Outlook to then place the email address of that person in column 'ED'
There are 35,000+ people in the address book and there may be over 5 email addresses for one name, so is there any way a message can appear for the user to select which email address is correct if there is more than 1 contact for that name?
View 1 Replies
View Related
Jun 17, 2008
If Not stfound Is Nothing Then 'if value is found then do this
is causing me a run time error 424 when I try and run my code "Object required". Entire code is pasted below...
Option Explicit ....
View 4 Replies
View Related
Dec 8, 2008
I have the following macro written:
Sub GT()Dim cell As rangeDim BeforeNull As StringDim FirstNull As StringDim InitialData As StringDim B As VariantFor Each cell In range("A1:A8")Alpha:InitialData = cellFirstNull = InStr(1, InitialData, " ", vbTextCompare)If FirstNull = 1 ThenInitialData = Right(InitialData, Len(InitialData) - 1)cell = InitialDataGoTo AlphaEnd IfIf FirstNull "" And FirstNull "0" Then BeforeNull = Trim(Left(InitialData, FirstNull - 1))If FirstNull = "" Or FirstNull = "0" Then BeforeNull = InitialDatacell = BeforeNullNextEnd Sub
Now after the final Next, I need the macro to select the last cell changed. Is there a way to do this?
View 9 Replies
View Related
Feb 7, 2007
Find the cell address where the user created button placed in excel.
View 2 Replies
View Related
Apr 5, 2008
I have found many posts similar to what I am trying to accomplish, but nothing that I have been able to modify and make work. I need a VBA script that will find a cell with the text data "Difference" and copy the adjacent (to the right) cell's data. I then need to find a cell with text data "Ops" and paste the previous data to it's adjacent cell.
View 3 Replies
View Related
Oct 5, 2013
In the following example, I need to create a formula to identify the cell address containing the string value "X"
BCDEFXABCDEFXABCDEF
Assuming this was row A, the formula needs to return $A$6 (or A6).
View 7 Replies
View Related
Aug 29, 2005
I'd like to have the cell address returned along with a value when I use the
MAX function.
View 13 Replies
View Related
Dec 8, 2005
I want a function that allows me to enter a range and then returns
the address of the cell with the minimum value. It is the Address I am
interested in, not the value.
View 14 Replies
View Related
Mar 3, 2007
Does anyone know the formula that produces the address (e.g. $A$1) of a cell within a table? I found the formula that gives the address of a single cell within a single row (or the address of a single cell within a single column). But I need the formula that gives the address of a cell where the row intersects the column. If I know the column header name and the row header name, how do I find the cell address for the two dimensional intersection?
View 11 Replies
View Related
Mar 8, 2009
I am trying to find a cell address from an area, like this:
A B C
1
2 hello
3
4
I need to find "hello" 's address from A1:C4, I found that the function MATCH works in single row/columns only.
View 2 Replies
View Related
Jul 17, 2013
I'm very new to excel. I need a formula to put in a column (I) that returns ONLY a five-digit zip code from the adjacent cell in column J, which is a full address. Nearly every entry is written differently, and many do not contain a zip code. I would like the cell to be blank if the cell in J contains no zip code .
I'm using the formula:
=MID(J5,MATCH(TRUE,ISNUMBER(-MID(SUBSTITUTE(J5,"","#"),ROW(INDIRECT("1:"&LEN(J5)-4)),5)),0),5)
This formula sometimes returns -**** format numbers, considering them to be negative and still five-digit. It also returns #N/A if no zip code is present, and I would like this to be blank. I'm sure I can nest the formula within an IFF, but have not been able to make it work myself.
View 4 Replies
View Related
May 27, 2014
Looking to find 1 of 2 words in a cell in column B and return the word found in the same row in column E. This seemed easy but I am not having any luck.
the cells in column B have several words in them but I am looking for 2 specific words "PLAT" and "ORIG". If the word is not in the cell, it should show a blank cell in column E in the same row, otherwise one of the 2 words should be in that row in column E. A VBA loop would be ideal but a formula that can do it might work as well.
View 3 Replies
View Related
Oct 1, 2008
I have a file that the user selects and when they enter a value (in this case, a job title) into the input box, my macro looks for the value in that file. If the value is there, a msgbox pops up that lets the user know that the value was found and it then goes to that cell, displaying in the next msgbox the cell address of where the value was found. I already have the code down for this part of the macro.
My problem is what happens if the file has the same value more than once. Ideally, I'd like to display a message box that returns the addresses of both cells with the same value and then prompts the user to select one of these values as the value they are looking for. I am not sure if a msgbox or a msgbox and then an input box are most appropriate for this situation. Once the user does this, the macro continues. The rest of my macro is built on the cell where this value is, so it is crucial that I make sure there is at least one value selected. Any help is much appreciated. I have included a sample worksheet of what this situation might look like.
Here is the code I presently have for this part of my macro.
Sub GetOpenFileName()
strFind = InputBox("Please enter the job title you wish to search for:", "Search for job title in this file")
If strFind = vbNullString Then Exit Sub
With Sheets(strSheetsMainCompProfile)
If WorksheetFunction. CountIf(Range(Cells(1, 1), Cells(100, 100)), "*" & strFind & "*") = 0 Then
MsgBox strFind & " cannot be found on this sheet"
Else
View 9 Replies
View Related
May 10, 2008
I am trying to clean up and simplify my macros by compartmentalizing frequently repeated commands. I like to search for text in column headings and define the cell containing it as a range that I can later use .column or .row commands on, so my macros are a bit more flexible. The code I currently use for this is
Dim XColumn As Range 奏he cell containing the text 店
Cells.Select
Selection.Find(What:="X", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Set XColumn = ActiveCell
I would like to be able to create a Macro (possibly name FindSetCell()) that will accept arguments and achieve the results of the above code in other macros
I think the command might look something like FindSetCell(鍍ext to be searched for,馬ame of newly Defined Range) But I have not figured out how to code it
View 2 Replies
View Related
Jul 1, 2014
I have a data table, called Table1 in Sheet1. In a simple form it is
Customer ID
Comment
A
asdf
B
jkl;
So in VBA, I need to figure a way to give me the cell address of the matching cell in Comments. So say Customer ID starts at A1 ... that means the Comment for Customer A is B2.
How would I get that reference in VBA?
View 2 Replies
View Related
Mar 16, 2014
construct a formula that finds a value in a range , then returns the cell address of that value.
Say, i wanted to find the amount 12385 from another sheet , range C2:AA12 (contains only numbers , no duplicates). result should give me the address of that value.
I have tried the address & match function but gives me an N/A error.
View 3 Replies
View Related
Oct 22, 2007
i had this formula at one time but lost it.
i am trying to figure out how to evaluate a column and get the cell address of the cell with the last entry
example
--A
1 e
2
3
4 g
5
6 h
all other cells under A6 are blank
the answer is A6
View 9 Replies
View Related
Nov 14, 2007
when I use the range.find function to find a certain value in a column.. i want to return the address of the cell.. and save it in a range variable. how would I do that?
so this is what i have now.. but Rng does not return as a range.. it returns 69... when i use ctrl + G and type ?rng
set rng = .range(A:A).find(what:=69, After:=.Cells(1, 1), Searchorder:=xlByRows, searchdirection:=xlPrevious)
ok so say it picks up..... cell A69... how do i get it to save range A69
View 9 Replies
View Related
Jul 27, 2007
I'm still getting to grips with the Find Command. Basically, I have the below code that looks at a line in a sheet(ws_Site) based on the Line ID Number that is in column A and then Finds that that LineID_Value in a different sheet(ws_main) and copies a value from column I on that line across. Problem is, if the cell I is blank it copies it across and essentially clears the cell if there was data in it.
How can I adjust the below code to only set ws_main.Range(c.Address).Offset(0, 8).Value = LineID_Value if LineID_Value is not blank?
For Each LineID In ws_Site.Range("A7:A" & SiteRows) ' Loop through all the cells in range
LineID_Value = LineID.Offset(0, 8).Value
'Dim c
With ws_main
Set c = .Range("A7:A3000").Find(LineID, LookIn:=xlValues)
'If Not c Is Nothing Then
ws_main.Range(c.Address).Offset(0, 8).Value = LineID_Value
'End If
End With
Next LineID
View 3 Replies
View Related
Sep 6, 2013
Is there any formula to find text and return its cell address? This is like when we use Ctrl+F function to find a text, and Excel then highlight the cell contains the referred text. At the same time, the name-bar displays the address of the cell. Now, is there any formula that can perform such task like this?
View 9 Replies
View Related
Mar 25, 2009
I'm using VLOOKUP to search for results in another worksheet. What I need is 0 returned if the search fails. Currently I'm getting #N/A and that's causing my other formulas to fail.
View 8 Replies
View Related
Mar 9, 2014
I'm looking to identify a keyword in a string and then replace that string with just the keyword.
The string is a product description. The keyword is a product group. The keyword can showup in any position in the string.
I can't post the actual data do to confidentiality requirements. but here's an example.
description
qty
price
keywords
code
green grapes bunch
1
2.5
[Code] .......
View 2 Replies
View Related