Lookup & Offset In Macro
Feb 5, 2008
The Vlookup portion is already working but I need the value located one row below that one.
here is what I have, which return the value itself, I cant seem to incorporate the offset function ion VBA:
Cells(x + 1, y) = Application.WorksheetFunction.VLookup(TempName, Worksheets("Data").Range("F1:F100"), 1, False)
View 3 Replies
ADVERTISEMENT
May 27, 2008
I'm trying to use an offset from a Named Range as my source cell in a vlookup but get a -1004 Object not defined error. When Debugged the Range.Formula appears to be blank when queried. Using Record a Macro the Reference to a named range worked fine but I could not test for an offset or the use of the range reference. What can I do to use to make this work
Range.Formula="=vlookup(Range(""SomeName"").Offset(1,0),DataRange,2,False)"
View 7 Replies
View Related
Oct 20, 2008
I have a set of data
Col A, B, C
A = Date, B = Interval e.g 08:00, 08:30, C = Number
My aim is to lookup to A+B in order to retrieve C
I have tried and offset within a lookup and upto now have been unable to proceed, I have attached the formulae I was using;
=HLOOKUP($I$4,Sheet2!$A$5:$A$6,OFFSET(B5,MATCH(H5,Sheet2!$B$5:$B$6,0)*0,1),FALSE) - returns the date value
View 9 Replies
View Related
Jun 19, 2006
I am trying to use offset & lookup, to return a cell x rows below the lookup value. I am able to get the correct result when I use the lookup and offset functions separately. When I nest the lookup function within the offset, I get an error.
View 6 Replies
View Related
Feb 2, 2007
I have a range of numbers in row 8 all of which are unique, then another range in row 20 (there are numbers in between but I'm not worried about those). I'm trying to get a code or formula that will find a user defined number typed into c30 (which can change) in row 8, then scroll down to row 20 (same column) and sum all the values from b20 up to and including this point (along this row). The number inputted into c30 will always exist somewhere in row 8.
I can't work out if this is possible using lookup/offset/cell/sum/other functions, figure it may need VBA.
View 7 Replies
View Related
Oct 30, 2006
I have a large array of cells that go from A1 to A2500. In VB, I need to take a given date that resides in a cell, say 1/6/2006 in C2, and look for a match of it within this large array. When the match is found, I need it to look in the column to the right (IE, from A5 to B5) and assign the value there to a Cell (C1).
Could someone provide an example of the code I was use in VB for this? I'm having a lot of trouble with it.
View 7 Replies
View Related
Dec 16, 2006
I have a worksheet of data that I am trying to reference to. I will have the data as a "dump" on one worksheet, and lookup from that sheet. I've attached an example of the data dump. I need to essentially VLOOKUP the value (i.e. 054_6425) and then count over 3 columns, and down two rows. I've tried INDEX MATCH, but can't get that to work. Can you get VLOOKUP to count over and down and return a value? File "example" is attached.
View 2 Replies
View Related
Jul 7, 2007
i'm trying to return a value thats offset but the position of the value may change each time data is imported. i've attached sheet displaying problem, as i can't explain clearly. i need to lookup the value in column A (yellow), then find and return the total percentage value in column C (blue). its always 2 columns across but the problem is it could be anything from 2 to 5 rows down.
View 6 Replies
View Related
Jan 30, 2008
I am referencing a value in column A of Sheet 1. I am looking for that value in column B of Sheet 2 and would like to return the value of the cell that is 1 row below and 4 columns to the right (column F). I need to do this multiple times.
Can I use a VLOOKUP/OFFSET combo or Index/Match?
I am writing the formula in column H of sheet 1.
View 3 Replies
View Related
Aug 7, 2009
In the attached workbook, the following formula appears in column B of the "dropdown" tab. I want to basically do a two criteria lookup, using the values in column A and the value of cell B1, which is a dropdown based on a dynamic range consisting of the company names on the Discounts tab.(starting with cell E1, extending rightward) To make this easier for testing purposes, I'm curretly using cell E1 instead of B1, which is just text.
It seems like this ought to work, but somehow it doesn't:
=OFFSET(Discounts!$B$1,(MATCH($E$1,Discounts!$C$1:$AA$1,0)),(MATCH(A5,Discounts!$B$2:$B$200,0)),1,1)
View 2 Replies
View Related
Nov 5, 2006
I am having a heck of a time coming up with the proper combination of functions to return data to my worksheet.
Attached, you will find a screen shot of the pages I am dealing with.
Here is what I am trying to do:
On the page named Update Master, I am trying to put formulae into the highlighted cells C2:C11. Each cell will contain a formula to MATCH the team name in UpdateMaster!A:A with a team name in the chart found on worksheet WEEK ONE. Then, I want to return the value found 8 cells down, and 1 cell to the right of that MATCH. Here is a specific example:
In cell Update Master!C2, I need a formula that will MATCH the value in Update Master!A2, , with a value on the WEEK ONE! worksheet. (In this case, 2EZ. After locating the match, I want to return the value found in the bottom right of that players weekly score box. (WEEK ONE!C9...in this example).
I can't make a direct reference to the data...because the value in Update Master!A:A will change after each week. The team names will be sorted in alphabetical order after being sorted by the value found in Update Master!AE:AE...(each player's accumulated score).
I have tried so many combinations of MATCH, LOOKUP, OFFSET, INDEX, ROW...etc., and I keep getting VALUE# or NA# errors at some point in the computation. Maybe one of you can point me in the right direction.
View 9 Replies
View Related
Apr 17, 2012
I am looking to do lookup list using the offset function. Scenario: I have 5 dealer groups, each with there own dealers. Each dealer has a list of customers. Once I select the customer it will bring up a list of their vehicles. I am stuck on selecting the customers and vehicles once the dealer group and dealer are selected.
View 1 Replies
View Related
May 2, 2006
on sheet 1
I have a list of race car numbers (20K, 15W, 2) in A1:A50 (may be more or less than 50)
Next to them in B1:B50 are the point values they earned for a night of racing. 100-97-94 etc.... these are points they have earned for a night of racing that week.
in C1 I have how many column over I need to write to (ex. 4 for Column "D" on sheet 2)
On sheet 2 I have all the total for each week.
example
A1 B1 C1
Car 4/22 4/29
20K 94 90
15W 97 100
......
What I need is some code to go down the driver list on sheet1 and write their points in colum D on sheet 2 when it finds the appropriate car number. If the car number does not exist then add the car to the bottom of the list (A50) or whatever, and write the points 4 columns over.
View 6 Replies
View Related
Mar 29, 2008
I have a data range set up in a step chart formation. This means there is a "Name" to the left and a time line of "values" to the right in quarterly increments (3 months at a time). Row 1 has the first month of each quarter and should be used to find the start date. Row 2 has the last month of each quarter and should be used to find the end date.
I need to find the first value from left to right and return the date directly above it in row 1.
Then....
I need to find the last value in the step chart and return the date directly above it in row 2
Example
Start Date..A...B...C....D...E...F
End Date....U...V...W...X...Y...Z
Value-1...........5...2....7........
Value-1
Start Date: B
End Date: X
Duration: = B - X
The reason i need this information is to create a Gantt Chart.
View 9 Replies
View Related
Aug 1, 2007
I have all my data on sheet 2 which contains tables that relate to information on regions, manufacturers, etc so it can be a large amount of tables which will change from month to month depending on a monthly list.
For example, if “Region 1” is in cell B134 – the resulting data I need to pull out will be contained in C138:G232 ...or ”Region 2” which is in B235 – table info is in C239:G333, etc, etc.
On sheet 1, I have a cell (L7) that is populated by another formula. This cell is effectively my lookup to pull out information from sheet2 to populate cells in (sheet1) AE119:AH212 - same sheet as the reference (L7).
I need to look up the reference/resulting value that is in L7 on sheet1, find and match against the values in column B on sheet 2 and then pull in the corresponding table information.
If the value in L7 was not changing at all I could do.. in cell AE119… =OFFSET(sheet2!B134,4,1,1,1) etc etc
... but I am at a loss as to the value in L7 changing and incorporating a lookup… or maybe I am looking at it wrong..?
I have looked up match, offset, index and lookups on the forum and have managed to confuse myself even more. I have even tried taking some of the example formulas and amending with my references but to no avail.
View 10 Replies
View Related
Mar 10, 2014
I have 2 columns of data (col A is time, col B is a value), in a range A4:B1000 (can be less, but the biggest the range will get is to B1000). Example:
A / B
4 10:37:55 / 91
5 10:37:56 / 92
6 10:37:57 / 93
7 10:37:58 / 100
8 10:37:59 / 105
9 10:38:00 / 110
10 10:38:01 / 111
11 10:38:02 / 115
12 10:38:03 / 120
Im looking for a way in VBA to look for a time entered in cell C1 (example 10:38:00), find that in column A, then return the average of values in column B that are offset 271 - 300 rows. This is entered in D1. So in my example, 10:38:00 is in cell A9, return the average of B280:B310.
View 3 Replies
View Related
Jan 30, 2008
The main worksheet in my workbook contains lists of suppliers with unique Vendor Numbers, of which there are approximately 4,500 rows. There is another worksheet which holds approximately 6,500 entries I need to bring data from that sheet to the main sheet using the Vendor Number and the information that is held on 4 columns unique to that number.
The information is a classification system that comprises of 4 columns holding a mixture of numbers and text.
Worksheet 1 has the Vendor Number in Column A and the Classification destination starting in Columns Q, R, S & T.
Worksheet 2 once again has the Vender Number in Column A, and the Classification information in Columns C, D, E & F.
What I need guidance on is how to build the formula to copy the information across, or direction into what other method I should be looking at instead.
View 4 Replies
View Related
Apr 4, 2008
In the attached spreadsheet you will see the table of data in cells e6:L16. In cell N6 i am doing a hlookup to find the date in the table of data that is closest to the date in cell A4. The formula in cell M6 is where i am having the problem and i was trying to pull in data that is 4 columns to the left of where the hlookup date is in cell N6. The problem i am having is when i input any date higher than 06/30/07 the Index formula does not display the correct date. What is confusing me is that the Hlookup formula in cell N6 still works with higher dates but the index formula does not.
View 6 Replies
View Related
Feb 14, 2009
I am trying to find a formula that would pick out a row from a matrix based on the values in the first column and then return to me each of the subsequent values from that row. I can't do a vlookup because there are a lot of blank cells and which columns have data changes. I've attached an example. The text in A1 will change and cells A3:B5 will show the corresponding values from that row along with the column title. I would prefer a formula to type in and leave in cells A3:B5 but if that can't be done VBA is okay too.
View 6 Replies
View Related
Aug 14, 2009
Cell offset within macro
I have a very basic macro controlled by a button as follows
View 2 Replies
View Related
May 31, 2014
I am having some difficulties using a combination of IF and the OFFSET function to display a range of cell values from another column based on a simple condition. The values I need to display at the destination cells should be offset by 8 columns to the right and "X" rows down from the reference column. The value "X" is to be determined via the IF function to check for the row index number.
For example, if Index value "X" = 8, then display the value of B2 in cell I9. IF X = "9", display B2 in cell I10 etc.
I have attached a sample worksheet that provides some examples.
View 3 Replies
View Related
Aug 1, 2006
I am attempting to creating a Macro in excel with an offset feature but I am having trouble getting it to work correctly. I will include what I have created thus far, but this is what I would like it to do. There are 2 columns, A and B which are header columns for rows 2 through 75. Columns C through G contain values which are referenced in formulas in the corresponding cells in columns H through the end of the sheet. Ideally after every day I would like to run the macro to hide the next 6 columns which are showing. So on day 1 I want to run the macro to hide columns H through M. On Day 2 I would like the macro to offset and hide the columns N through S and so on. Each day an additional 6 columns (which is the all the data for the previous day) need to be hidden so that the current day's data is showing and can be easily read alongside the headings which flow vertically down columns A and B. If you could please help me with the proper form of this macro I would greatly appreciate it. This is the current macro I have made, I would like to add an offset command in there but am unsure which line to tie it to:
Sub HidePreviousDay()
'
' HidePreviousDay Macro
' Hide the Previous 6 Columns (the entire last day)
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Columns("H:M").Select
Range("H2").Activate
Selection.EntireColumn.Hidden = True
End Sub
View 3 Replies
View Related
May 2, 2007
I am in need of perhaps a code that will allow me to offset the data which is highlighted in yellow to something that is similar to the data which is highlighted in green. The logic behind that is i do multiple loans that begin at various months of the year and must be presented into the business plan accordingly.
In this example "spreadsheet included" i chose payment 1 as January but some loans dont begin payment for 2 or more months. Hence the expense and hence the numbers located in the "Control Box" will then be able to offset the data down the number of rows that i specify in the control box at the upper left most of the screen into the section that is highligted in green respectively.
Once the data has been shifted i then need to transpose the data to every two columns in the far most payment schedule which includes the principle "prin" and the interest "int" in the respective months broken down. I need the ability to offset this data a maximum of 11 months as 12 would push the loan into a different year.
I have 15 simultaneous loans so i would need a macro that can do this for me. I am a beginner coding but very familar in excel and a formula would not work as it would be over written each time. I am thinking of if statements but that would be a pain in the rear.
I would then need to repeat this macro for the next 14 loans but in this case i would need to do it four more times and then i would need to do the same procedure for the interest side of the loan.
View 11 Replies
View Related
May 21, 2009
I am attempting to do is have a macro (Via Command button) go through column A to find the word "TOTAL". Once that is found I want it to offset by 3 rows (from the word "TOTAL") to grab the number and place it into column B.
View 2 Replies
View Related
Jul 9, 2014
I am trying to color a cell with a macro. I am using
ActiveCell.Offset(a,b).Value= a number then a want to change the color of the cell to yellow. When I tried to code this, my Active cell's color is changed, but not the offset cell.
How do I change the color in an "offset cell".
View 5 Replies
View Related
Nov 19, 2006
I have created some code to look in a cell to see if the name matches that which has been input in a drop down list on a combo box on an input form and then copy the value of column 10 in the same row. I created a public variable for that name as txtTenant.
What I wanted to do was to then write the code that if the first cell did not match the name selected (txtTenant) that it would then drop down one cell and compare it and keep going down until it finds a match, right down to the end of the column of data if necessary.
My coding is not working - it stays at the first person it finds in the first cell. I am not sure if I should be using For...next loops or loop.....
This is the
Sub FillData()
Application. ScreenUpdating = False
RentRow = 2 'sets the first row as row 2 in the data sheet to copy from
NewRentRow = 7 'seta the row to copy to in txtTenant
View 9 Replies
View Related
Jun 13, 2008
The message shows me "Can not get the vlookup property of worksheetfunction class" and don't know the reason. The 'plancomm' and 'bonus' is the range name in different worksheets of the same workbook as the rngcell.
Case Else:
.Offset(0, 1).Value = WorksheetFunction.VLookup(rngCell.Offset(0, -3), Range("plancomm"), 2, 0)
.Offset(0, 2).Value = WorksheetFunction.VLookup(rngCell.Offset(0, -4) & rngCell.Offset(0, 1), Range("bonus"), 6, 0)
View 3 Replies
View Related
Nov 1, 2006
- Find a value on a sheet “ORM” in Column G5:G33
-Get the corresponding value of B5:B33 of that cell
-Place that corresponding value in a canned remark: “You have the number 2 in Block, 12, 14, 25 22.
-Place this canned remark in TextBox31
View 9 Replies
View Related
May 13, 2009
I am in the process of writing a VBA code(I should I am fairly new to this code writing!!!).What I need to be able to do is below.(enclosed please find a output in an xls file) What I should be able to do is below:
1.Find the text "Cash(No Listing)(Monthly)"
2. Offset to the 13th Column after that
3.Select the value in this column ,copy the value
4.Go to a row above and move one column to the left i.e.offset (-1,-1) and move 12 column backwards i.e.offset(0,-12)
5.Copy the value in 3 above to this entire range
6.Repeat this process for the entire file
My code is as below.Let me know where am I making a mistake. Just to let you know that this code performs the job well for the first entry i.e in the yellow makde area and doesn't do the job for any further entries .Llooks like I have some problem with the loop but not sure as to whats happening!
View 3 Replies
View Related
Feb 4, 2014
I am trying to find a macro that can search a sheet for any cell that contains the text "Not on AOI" selects a range that contains that cell, 81 rows below, and 2000 columns to the right, then cuts the selection and pastes it 162 rows below the original cell where the text was found. What's hard is that the number of columns between the "Not on AOI" cells is variable.
I'm very new to excel macros and the parts I think I've put together are:
Cells.Find("Not on AOI", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=True).Activate
[Code].....
View 1 Replies
View Related