VBA - Lookup For Value In A Range And Returns Its Column Header
Jan 16, 2014
I have a table (A1:C5)
A1:C1 contain the table headers
A2:C5 contain the data
A6 contains the value I want to search for I use this formula to return the column header of A6 A6=INDEX(A1:C1,SUMPRODUCT((A2:C5=A6)*COLUMN(A2:C5))) Now, if there are duplicate values in A2:C5, this will return more than one column header What I need is a vba code to view a msgbox with all column headers returned in this case
View 1 Replies
ADVERTISEMENT
Feb 9, 2010
I need a formula to lookup and retrieve data from a table of values. Given an EMP-ID in column A of the row that contains the formula and given a column name in row 1 of the column that contains the formula, I need to do a lookup. So, in effect, I am doing a lookup based on two values .. the column header and the row header.
I have attached a small model to illustrate what I need. Cell C-3 in the first worksheet will contain the formula to lookup and retrieve the value in cell C-7 in the second worksheet, based on the values in cell C-1 (column header = “Database Col 2”) and in cell A-3 (row header = “257”) in the first worksheet.
View 2 Replies
View Related
Jun 21, 2013
I'm trying to calculate a figure in a report tab that reads off the data tab and looks for a specific column based on the header of that column. My explanation is admittedly poor but I've attached a sample file with an outline of what I'm trying to do which I hope makes things clearer.
Sample File.xlsx
View 2 Replies
View Related
Aug 11, 2009
I have a spreadsheet an excerpt of which is as follows:
K L M N
1 Doors Security Vehicle Key
2 TRUE FALSE FALSE FALSE
3 FALSE TRUE TRUE FALSE
4 FALSE FALSE FALSE FALSE
Want I want to happen is to return the column header where there for a cell which contains "TRUE" in a blank column. If there isn't a cell with the value "TRUE" then to return "N/A". In the above example in blank column P for Row 2 would be "Doors", Row 3 would be "Security,Vehicle" and Row 4 would be "N/A".
In my actual spreadsheet I have 12 columns (L to W) which have the TRUE or FALSE values.
I know it has something to do with either HLOOKUP, INDEX and MATCH but can't seem to get it right. Any ideas?
View 4 Replies
View Related
Feb 6, 2009
Basically i have a manpower chart with months along the top and names down the far left. People are going to start work in different months so i want to know at the side of each persons name the month they start. Heres a simple example
I have column headers starting at B1 thru F1, with the following values Month1,Month2,Month3,Month4,Month5
In cell D2 i have the value 1
I want Cell A2 to return the value Month3
Whats the formula i need to input in A2
View 9 Replies
View Related
Feb 6, 2009
i have a manpower chart with months along the top and names down the far left. People are going to start work in different months so i want to know at the side of each persons name the month they start. Does that make sense? Heres a simple example
I have column headers starting at B1 thru F1, with the following values Month1,Month2,Month3,Month4,Month5
In cell D2 i have the value 1
I want Cell A2 to return the value Month3
Whats the formula i need to input in A2
View 9 Replies
View Related
Nov 18, 2008
I have a list of names and the chores they need to do on a certain day. I need a formula that returns the chore the person needs to do when the date is filled in.
Ex: Sheet2 Col:A has names filled in A2:11 , row B1:J1 has dates that you would input.
formula goes in B2:J11
Sheet1 is the master with all the data the formula would be pulling from.
column A2:A11 has the names , row B1:S1 has the chore that needs to be done.
B2:S11 has the dates already filled in.
View 5 Replies
View Related
May 16, 2013
I'd like a formula that'll return the column header by matching a lookup value with a table in the second sheet.
eg: sheet 1
Name
Cell
Region
John
111-2222
[Code] .......
The formula should match the name in A2, John, with value from the table in sheet 2 and return the correct region, this case North.
View 1 Replies
View Related
Feb 1, 2010
I have a table with 3 columns. See below for data (ignore dashes):
COLUMN X-----COLUMN Y-----COLUMN Z
Project 1---------21 Dec 09---------$70
Project 2---------21 Dec 09---------$85
Project 3---------21 Dec 09---------$90
Project 1---------1 Jan 10-----------$85
Project 2---------1 Jan 10-----------$95
Project 3---------1 Jan 10-----------$110
As you can see, COLUMN X contains Project Names, COLUMN Y contains Dates and COLUMN Z contains Monetary Value.
Here is what I need to do: I need a formula/function that will lookup "Project 1" in COLUMN X and find the latest corresponding Date in COLUMN Y (for this example, 1 Jan 10) for Project 1 and then display the corresponding Monetary Value from COLUMN Z (for this example, $85).
I have tried using VLOOKUP, but since the data must be sorted it won't work. I tried using INDEX(MATCH), but can't get it to work. My goal is that the cell will be dynamically updated every time a user inputs updated data for a certain project based on the latest date.
View 3 Replies
View Related
Mar 5, 2014
I am having trouble with my macro. I have attached excel sheet for reference.
Basically, I want a Macro that Looks up columns B & C of current sheet and matches it with table in the charges tab, and then returns hourly pay in column D.
I have created the macro but it's giving me Run time 1004 error.
Also, my formula is incorrect. Maybe that's why my macro isn't working?
2WayLookup_Macro.xlsm‎
View 4 Replies
View Related
Mar 12, 2003
How would a code look like to select a range with a column header on top. in the code you provided, it selected the entire W column. How would you select the range given that the W column was called Address?
Sheets("Sheet1").Select
Range("W1").Select
Range(Selection, Selection.End(xlDown)).Name = "Problem_Area"
View 6 Replies
View Related
Oct 21, 2009
I've got numerical data in columns A through AF, starting in row 4. I need a formula, starting in AG4 that I can drag down. I need the formula to look back across the row until it gets to the last posistive number, then return the column header of that column (the column headers are in row 3)
so for example
Header row
Jan Feb Mar Apr May Jun Jul Aug
Data
0 3 0 0 8 0 0 0
the formula would return May in this example as 8 is the las positive value and the column header for that column is 8. There are no blank cells in the data.
View 9 Replies
View Related
Dec 4, 2007
I want to select a range in a spreadsheet and then set it as the print area. the last column I want to be selected is contains the text data "ABC" in row 1 and is the only column with data "ABC" in row 1. The last row I want to select contains the text data "DEF" in column 1 and is the only row in column 1 containing the data "DEF". Basically I want to select the range [A1:column("ABC")row("DEF")] and then set it as the print area.
View 2 Replies
View Related
Nov 18, 2011
I've been trying find an appropriate formula to extract the column header from a table in a different sheet if the row header and value in that table is known.
in the lookup table the row titles (column A) are product codes, column titles (row 2, D through AX) are business names and the table values are quantity.
In a different table I have product codes in column A and in column B i have the max number/quantity of products for that code. In column C i want to put the company name associated with the product and the number/quantity.
View 4 Replies
View Related
Oct 1, 2009
I have a worksheet with the following values:
header row 15 17 19 25 etc.
each column underneath the row will have a value of 0 or -1
A B C D E etc
1 15 17 19 25
2 0 -1 -1 0
3 -1 0 0 0
4 0 0 0 0
etc
I want a formula that I would put in each row that would return the value of Row 1 if there is a -1 below that value. So, in this example:
Row 2 formula would return 17,19
Row 3 formula would return 15
Row 4 formula would return nothing
View 9 Replies
View Related
Dec 16, 2008
i am trying to lookup up when ppart matches spart and subtract total shipped from total produced. Here is where I am getting stuck .... because spart has multiple returns LOOKUP(2,1/((I2=C:C)),J2)
View 3 Replies
View Related
Mar 31, 2009
I need to lookup a Order Number and return all associated Item Numbers. My spreadsheet has about 10,000 lines and these Order Numbers could have as little as 1 or as many as 15 Item Numbers associated. I would like to have a drop down on each Order Number that shows the Item Numbers.
View 3 Replies
View Related
Mar 27, 2007
I have a very basic spreadsheet to calculate golfer handicaps based upon a course index. For some reason, my "LOOKUP" formula is not retrieving the data from the cell (column) next to the value I am searching...?
View 9 Replies
View Related
Apr 23, 2007
Im trying to do a lookup but when I drag the formula down it returns the wrong values and also returns #N/A or #REF (which I think means it's refering to a wrong range and cant find the data???). How can I do a look up function by dragging the formula down a long column of data eg. 65,000 rows in excel, that returns the correct text. I have attached a simple example- see attached.
View 4 Replies
View Related
Jul 16, 2009
I am using this formula
View 9 Replies
View Related
Oct 29, 2008
This formula works perfectly except when worksheet 2 has a code that is not on worksheet 1, then I get the error #N/A. I understand why I get the error, but not how to fix it. Obviously some sort of nesting - but what and how?
What I want on worksheet 2, column I - if there is a code on worksheet 2 but not on worksheet 1 - a return of "N/A"...
View 9 Replies
View Related
Jun 9, 2009
I'm trying to do the next level of a v-lookup. I have a group of data with a text "flag" on certain rows. On my summary worksheet, I'm trying to do a lookup or a nested index function retrun all of the values with the text flag next to it.
I've been playing around with nested formulas and this is where I'm stuck. Here's what I came up with:
=INDEX($D$1:$E$9,(SMALL(IF($D$1:$D$9=$A$1,ROW($D$1:$D$9),ROW(1:1)),ROW(1:1))),2)
This only works for one row and not for the other rows. Maybe I'm going down the wrong path?
View 9 Replies
View Related
Nov 21, 2007
I'm trying to generate a message box when a lookup cell returns the #N/A error value.
The lookup formula (=VLOOKUP(O8,Prod_Lookup,6,FALSE)) is in a "helper column" and returns a value of 0 if there is no entry in the lookup source sheet, but returns a value of #N/A if a non-matching date is entered in the active worksheet.
I have the following, but need some help in getting it work correctly. At present, it doesn't trigger the message box to pop up.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Prod_Val As Range
Dim note1 As String
Set Prod_Val = Worksheets("C_Data").Range("P8:P7000")
note1 = "Brazer PPM cannot be calculated because the Daily Production Count" & vbLf & _
"has not been entered for this date." & vbLf & vbLf & _
"The Daily Production Count must be entered prior to entering the daily leak data." & vbLf & vbLf & _
"Upon clicking the OK button you will taken to the Production Count sheet to enter the data."
View 3 Replies
View Related
Jan 12, 2008
I'm getting cross-eyed from trying to find the source of the error and not having any success. I've successfully used this approach many times, but for some reason I'm getting an error I can't pin down.
The problem: INDEX-MATCH lookup formula returns # NAME error. Formula: =INDEX(Data,MATCH(H8,Date,0),MATCH($I$7,Line,0),MATCH("FPY",Hdngs,0)). I've done my best to verify the named ranges and cell references are correct and have stepped through the help file on the "potential source of the error", including going to Tools >Options and making sure "Accept Labels in Formulas" is checked, as well as having read a number of other posts.
View 7 Replies
View Related
Feb 11, 2013
I have a sheet that begining in A3 and going down need to look for the First Instance of the text String "Loan Documents" and down to the last instance and select the corresponding range in column B.
Example: if the Text String appears in Range(A14:A32) I need the Range(B14:B32) to be my selected range.
View 1 Replies
View Related
Feb 23, 2014
I get a Type mismatch from this line:
x = Application.WorksheetFunction.Lookup(2, 1 / (Range("G7:P7") = "A"), Range("G7:P7"))
View 1 Replies
View Related
Mar 3, 2009
I'm trying to create a lookup formula where it matches the beginning of words and returns the value of a cell I choose. This is my layout. In Workbook1 in column E I have a list of medicine names which i'm putting in from personal medical lists. These names are not "complete", i.e. they aren't the exact names of the medicines. In workbook 2, I have a sheet with the exact names and corresponding codes of the medicines. I want to return the code of the medicine. The beginning of the names of the medicines are the same, so I want to lookup the the X first letters of the medicines I write in manually (Workbook1 column E) and find it in Workbook 2 column B and return value of Workbook2 column A for that medicine (on the same row).
View 5 Replies
View Related
Apr 22, 2008
I setup this function to pull my staff's schedule an auto generate the forms i need however the lookup function works properly sometimes and improperly others i checked the syntax and it is correct how ever the wrong data is continually returned. I have attached the file if anyone can help. the VISUAL PLAN tab is the one contaning the formula and it pulls data from PLAN, CURENT SCHEDULE, AND CATAGORY SUMMARY however the only formulas hat i have a problem with are the ones referencing CURENT SCHEDULE.
View 9 Replies
View Related
Aug 13, 2008
I have a file created in Excel 2003 that uses a vlookup to reference another file, also created in Excel 2003. The function returns VALUE when the referenced file is closed. I get the VALUE error whether or not I update links upon opening the file. If I open the source file, the function calculates properly.
Here is the formula when the referenced file is open:
=VLOOKUP(A38,'[June Scorecard confirmation.xls]VPSC Summary'!$C$10:$F$22,4,FALSE)
The full & correct path appears in the formula when the referenced file is closed.
Columns C, D & E in the referenced range contain text, column F contains a Sum. This file is linked to another file, also using lookups. The linked area in this file works without problem, but it is a precedent to the calculation in column F.
Both these files reside on a network in subdirectories of the same logical drive. I am using a laptop that briefly had Excel 2007 installed on it, but was wiped clean before it was issued to me.
View 3 Replies
View Related
Aug 24, 2009
Here is my spreadsheet
A B C D 1 Matt 5 4 75 2 Joe 25 23 66 3 Ron 31 33 82 4 Jim 22 45 91 5 Steve 99 100 11
I used the large function to find the top 5 greatest numbers. I have them ranked in another area below the first set of numbers.
100
99
91
82
75
I need to find some sort of formula to return the name for the appropriate number. For example, I need the cell immediately to the right of 100 to return Steve; 99 to say Steve; 91 to say Jim. The INDEX/MATCH formulas used for left lookups works only for a column. I would have to set the index/match formula individually for each column to the right of the top 5 numbers, and that defeats the purpose. I might as well just find the numbers and connect the names all by hand.
View 9 Replies
View Related