Lookup Formula In Macro
Dec 26, 2008
I need to know how can I code a Lookup formula in a VBA.
In Sheet1 of excel, I have several records of data in column A to E.
I have designed a userform, in which user enters data of column A in a textbox and on click of a button, it writes the textbox value in Sheet2.
I need to code a formula in VBA, so that column B and E of Sheet1 data is written in column B and C respectively of Sheet2 (corresponding data of textbox value).
View 9 Replies
ADVERTISEMENT
Jun 26, 2008
I'm running against this problem: a file should be run whenever people want.
however, the last part to complete the file is that the file from yesterday should be opened.
From this file data will be extracted via the VLookup formula...that's the plan.
However, with dim statements it won't work.
for now the code is:
Dim mynum, mysearch, this1, that1, other1
'Open the file from yesterday. Define the date string of this week and last week
mysearch = Left(mynum, 8) & Right(mynum, 2) - 1 'mynum is a date string like 2008-06-26
this1 = "Outstanding invoices " & mynum & ".xls"
that1 = "Outstanding invoices " & mysearch & ".xls"
Set other1 = Workbooks(that1). Sheets("Raw"). Range("comments")
ChDir "Z: FINANCEF&AAPInvoices overdue"
Workbooks.Open Filename:= _
"Z:FINANCEF&AAPInvoices overdue" & that1
the "this1, that1" etc appear when you point with your mouse in the code as correct but
the VLookup function won't work: it takes a long time and when interupted the macro the cells show the VLookup formula with "[that1]" instead of the workbook's name.
I also tried to dim that1 as workbook but that did not help.
View 3 Replies
View Related
Nov 12, 2008
I have 3 Sheets named Paid, Rejected, and Reprocessed.
On the Paid and Rejected sheets I have 2 fields Customer # (Column A), and Amount (Column Q). (The customer # field has many duplicates but the amounts are never duplicates)
On the Reprocessed sheet I have all the rejected items (all fields) and also a field named Reprocessed. I need to use a formula that will check the Paid sheet for any items that have the same Customer # and Amount and return the amount
There are 8,216 rejected items and 45,047 paid items. Some items were originally rejected have been reprocessed and show under paid.
Any thoughts on which formula I should use?
View 10 Replies
View Related
Jan 28, 2009
In my workbook I have multiple sheets but I'm attaching a very simple workbook to demonstrate what I'm trying to accomplish. In my "Lookup" tab/sheet. I want to have known Latitude and Longitude data that will exist in columns A&B. Columns C & D will have address numbers and Street Name. I would like my lookup formula to find the longitude and latitude data from my "lookup" sheet, when the matching address information is typed in, in my 2009 sheet. I have to keep the street numerics and street name separate on this worksheet as well. I believe I'll need two separate lookup formulas as I need these formulas to start in cell G4 & H4 in my "GeoCoding1" sheet. Is it possible to have four columns of data to be viewed in a lookup formula? I tried this formula in cell G4 (GeoCoding1 sheet)
View 3 Replies
View Related
Jan 30, 2014
Why this below formula is giving me a #N/A result when entering 'Motorcycle', '4x4' or 'SLR' into cell H2?
=SUM((LOOKUP(F2,{0,"Standard"},{0,8.99}))+(LOOKUP(H2,{0,"SLR""motorcycle","4x4","Standard"},{0,12.99,9.99,10.99,8.99}))+((LOOKUP(K2,{"Acrylic","Aluminium"},{0,7}))*IF(AND(E2="Y",G2="Y"),2,IF(AND(E2="Y",G2="N"),1,IF(AND(E2="N",G2="Y"),1,0)))))
If there is an error?
View 12 Replies
View Related
Jun 20, 2007
does anyone know if there is an easy formula to have a cell (h18) copy another cell (J2) if the value in a cell (h17) is greater than the last value entered in the row (17), and if it is not greater than the last value, or if there is no other previous value, to copy cell (K2)
View 14 Replies
View Related
Jan 12, 2009
I am using the following formula to look up data from a seperate sheet and cannot get it to work. all three numbers are on the seperate sheet ... some show correct and others show not there when they are,
EXAMPLE
DATA
A B
99993728569820 you found it!
99993728569820 no
99993767688837 you found it!
FORMULA
{=IF(A3=Sheet1!A:A,"you found it!","no")}
View 2 Replies
View Related
Jun 18, 2007
Is it possible to have a macro on vlookup formula? Tried the below code but the lookup result is not what it should be. I know this could easily be done a keying in the lookup formula without using code. But it would be faster if it could be done by using a macro.
Dim c As Range
Sheets("Data").Select
For Each c In Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
c.Offset(0, 1).Formula = Application.WorksheetFunction.VLookup(Cells(1, 1), Sheets("Master").Range("A1:B10"), 2)
Next c
View 6 Replies
View Related
Jun 8, 2007
I got a table of two columns (A1:B6). One column (A1:A6) got temperature values and the other column (B1:B6) got enthalpy values as a function of temperature values as shown in the attached file. All values in the table are empirical values and I am trying to use them to obtain the enthaly (B11:B21) for my own temperatures (A11:A21).
I can use VLookup formula to do so but it won't be accurate because the enthalpy values are very sensitive to temperature changes. I need to use table A1:B6 and interpolate for temperature values that are located in between the integer temperature valuse. e.g. if the temperature=1.5 (between 1 and 2 in the table), how can I obtain the enthalpy value=15 (between 10 and 20) using the table.
View 9 Replies
View Related
May 13, 2014
How to arrange a lookup formula.
Book2.xlsx
In this example, I am attempting to look up one value based on two criteria. The month must match, and the location must match. In doing so, the value "1" should be returned in the example.
View 3 Replies
View Related
Apr 6, 2009
I have rows with text and numbers. In order to ensure that the numbers are accurate, I have a "QC formula" that calculates a check using all of the numbers from 1 row. The challenge is that the "QC formula" needs to vary depending on a text value within the row.
How can I lookup up the text value and then return the correct active formula for that row? I have too many differet text values to do a nested If statement. see simplified example below.
Condition ABCFormula' Needed based on Condition
Red123A*B*C
Blue123A+B+C
Green123(A+B)*C
View 13 Replies
View Related
Oct 6, 2009
A B
1 2
1 3
1 2
2 3
3 2
1 2
2 1
Im trying to work out a formula that will look down Column A for the number 1 and then will count the number of times the number 2 appears on the same row as number 1 in Column B. The answer I should be getting is 3.
View 3 Replies
View Related
Oct 28, 2009
I am trying to calculate a value by using two lookup statements in one formula. However, I get either #N/A, or very wrong results. Here is the formula:
=LOOKUP($B26,GrapePricing!$A$2:$A$15,GrapePricing!$B$2:$B$15)*
LOOKUP($B26,$B$5:$B$17,$D$5:$D$17)
What I need is to get the value in B26 (it is text, "Merlot"), go to the GrapePriceing sheet and find Merlot in range A2:A15, get the price of Merlot from the GrapePricing sheet range B2:B15, then multiply that by the matching value in the D5:D17 range.
View 5 Replies
View Related
Aug 3, 2009
The enclosed spreadsheet includes a couple formulas I’m having trouble with.
The questions themselves are detailed in the document.
View 7 Replies
View Related
May 8, 2012
I have been struggling with what seemed at first like a very simple formula. I have the sample data as shown below and I am trying to work out a formula that provides the latest value in sheet 2 from sheet 1 column AF based on a number of conditions.
If Sheet2 A1:A500 = Sheet1 F1:F500
And Sheet1 G1:G500 = max & Sheet1 AF1:AF500 doesn't = blank (i.e. last value in column AF)
Then return adjacent value from Sheet1 AF1:AF500
Sheet 1
F-----G-----AF
127--1-----15.6
127--2------3.1
128--1------2.0
128--2-----
129--1------2.5
129--2------1.6
129--3------2.7
130--1------3.3
130--2------3.1
130--3------1.6
130--4------5.4
130--5------
130--6------
Sheet 2
A--------B (desired results)
127-----3.1
128-----2.0
129-----2.7
130-----5.4
View 8 Replies
View Related
Feb 23, 2014
I need a formula to look up the value in another workbook. I have a number of workbooks that have a list o competitor's names and their scores The competitor names are not in the same order in each workbook. I have created a master workbook to extract the score from each workbook. I need the formula to match the name in another workbook and then pick up the score cells to the right.
View 4 Replies
View Related
Sep 19, 2007
Possibly to combine If statement and lookup stmt. I have a spreadsheet that calculates principle, interest, and combined pmt amount based on certain amortization and payment frequency. In one cell I would like the expiry date to pull in (the expiry date would be the date that the fund balance would be at zero ie. all payments have been made and principle is nil). I am trying to make a formula that will search down the payment column and when it sees a negative number or zero, it will fill in the expiry date (which is in a second column) that is attached to that figure.
View 9 Replies
View Related
Dec 3, 2008
I have the following:
"ClosQtr" = 8034 (Closqtr is a named range cell)
As a named range cell "Curr_Mth" changes (which can take end of month values from 30Jun08-31Dec09 only),
I would like A2 to be:
ClosQtr+1 "Curr_Mth"=30Jun08
ClosQtr+1 for 30Jun08
View 9 Replies
View Related
Oct 12, 2009
I am collecting a lot of prices from over 60 countries. Each country has a seperate sheet in a workbook, named "Country" Spec (eg Australia Spec, China Spec etc.).
These sheets are all setup exactly the same.
I have the following sheet wherin I want to show the data coming from all the different sheets:
| a | b
-----------------------------------
1 | Australia Spec | "Formula"
-----------------------------------
2 | Bangladesh Spec | "Formula"
-----------------------------------
3 | China Spec | "Formula"
In B1, 2 3 etc I want to do a lookup of a fixed cell on the correct country sheet. Therefore I want to include the sheetname in the formula. Thus I would like in B1 the content of cell q13 of sheet Australia spec. In B2 the content of cell q13 of sheet Bangladesh Spec.
My current formula is:
=INDIRECT(a1&"!$Q$13")
But it doesn't work
View 9 Replies
View Related
Nov 4, 2009
I have a spreadsheet with a list of thousands of products in Column A. In Column B, C, D, E, & F there are headers that read: Cincinnati, Dayton, Columbus, Toledo, Cleveland.
In the rows under these column headers it’s either blank or there is a 1. The value 1 represents usage of products (column a) in those markets (columns b thru f). I guess I could use a Y for yes but I used a 1 instead.
In another workbook, I have a short list of a dozen random products that I am trying to match up to the cities that use them. Is there a simple formula that would search for a specific product in column a & return the first market with the value 1 in the corresponding cell?
View 9 Replies
View Related
Dec 15, 2006
I'm creating a customer manager spreadsheet. I have my data set up and hidden above the data area, so I can get autocomplete to work. What I want to do is allow my sales reps to pull up the customer information by typing the customer name, etc, which I can do with Vlookup.
I then want them to be able to type in notes into a string which is attached to the customer's row of information. For instance, Customer ABC is on Row 2, their name is A2, address is B2, and notes are C2. However, Vlookup won't allow me to change the cell it finds, only display its contents. I'm sure I'll need a submit button, and possibly some VBA, but I'm not very good with it, and I can't find the answer anywhere else. Let me know if you need any more information. I'm sure it's simple, I just can't find how to do it.
View 7 Replies
View Related
Feb 7, 2007
I am trying to solve a problem with = LOOKUP. Here's the data. A1 can have a value between 1-100.
IF A1 IS <80.00, NO MULTIPLICATION IS NEEDED
IF AI IS 80.01 TO 85.00, MULTIPLY A2 BY 0.37%
IF AI IS 85.01 TO 90.00, MULTIPLY A2 BY 0.52%
IF AI IS 95.01 TO 95.00, MULTIPLY A2 BY 0.87%
IF AI IS 95.01 TO 100.00, MULTIPLY A2 BY 1.07%
Is there a =LOOKUP formula that can be used here?
View 2 Replies
View Related
Jun 20, 2007
It appears my formula = lookup(B1, {"April","August","December","February","January","July","June","March","May","November","October","September"},{"04_","08_","12_","02_","01_","07_",06_","03_","05_","11_","10_","09_"})
is not complete with the last parenthesis and I cannot exit the cell with the formula as is above. It looks right to me, what am I missing?
View 4 Replies
View Related
May 6, 2014
I'm trying to cross-reference three sets of criteria to find my result; however, I can't get the VLOOKUP function to perform correctly for this need. Maybe I'm using the wrong function.
I attached a simple workbook to highlight my challenge. The over-simplified language that I included in the attachment, which highlights my problem, is as follows:
IF:
(B5=Sheet2!B4:B12) ---> This line finds the correct row to reference, on the Control sheet.
(year(C2)=Control!C3:E3) ---> This line chooses the correct annual column on the Control sheet, for the given month (e.g., use 2014 assumptions for a 2014 month).
(month(C2)=Control!E14) ---> This line counts the expense only in the month when the expense recurs (e.g., April 2014, April 2015).
THEN:
SUM(Control!C4:E12) ---> This line finds the specific number based on the criteria above.
View 4 Replies
View Related
May 23, 2014
Combine two lookup/IF formulas:
[Code]......
So if formula 1 conditions aren't met then it by default would result in formula 2 conditions being met.
View 5 Replies
View Related
Jul 8, 2014
I am looking for a formula that will add some numbers for me on different sheets based on a sorted option that I choose on my Summary tab. sample survey (1).xlsx Here is a sample workbook with what I am looking for.
View 3 Replies
View Related
Jul 23, 2014
I have a list of numbers column A and a list of dates in column b, i need a formula which looks up the most recent for each of the numbers. can this be done?
View 3 Replies
View Related
Oct 20, 2008
I have a list of account balances in one column. How can I pick up only the bottom number in that column? I have 20 worksheets and want a total across all worksheets of the last number listed in a particular column but each worksheet is different because they contain a different number of rows with activity. So, if in col. C I have:
$482
$1,000
$899
$456
$231
... then I want $231 to be what is captured for that worksheet, but if the 2nd worksheet contains:
$500
$1000
$344
... then I want $344 to be what is captured for worksheet 2. Does that make sense. In the end I want to sum $231, $344.... etc.
View 3 Replies
View Related
Jan 26, 2009
I have a spreadsheet that is comprised of 3 columns:
Column A - a list of values
Column B - the rank of the value in the adjacent cell in column A out of all values in column A
Column C - the quartile rank (1, 2, 3 or 4) of the value in the adjacent cell in column A
I would like to create a formula that would return the highest value in column A that is ranked in the 2nd quartile.
View 3 Replies
View Related
Apr 16, 2009
I have a two worksheet file.
On one worksheet I have every day of the year (work day) and corresponding data for many topics for that day in the column.
On the other worksheet I want the user to type in a date and have the data for that day from the first worksheet display in a specific cell (based on the date entered at the top of the sheet) on the second worksheet.
I think it is some type of lookup formula but am not sure.
Enter todays date on one worksheet and have data display based on that date from a second worksheet. The data on the second worksheet would be manually updated every day.
View 10 Replies
View Related