I've searched for a solution for this issue I'm having but I haven't been able to find anything.
Let's say I'm working out of 2 worksheets, A and B.
Worksheet B has a cell I'll call Price. Price depends on a certain input, which comes from the AJ column in worksheet A. Price gets a dollar value from column BW inside of worksheet A.
Worksheet A has a column (AJ) and a column (BW).
My question is this. How can I click on the cell in worksheet B (Price) and be redirected or "hyperlinked" to the appropriate cell in Worksheet A column BW?
You can place formulas within the hyperlink function
=HYPERLINK("[book1]SheetA!BW" & MATCH(C3,AJ:AJ,0),INDEX(BW:BW,MATCH(C3,AJ:AJ,0)))
In the above
Hyperlink is the main function
"[book1]SheetA!BW" - you would change to your workbook name. this is telling it which sheet and column to link to
MATCH(C3,AJ:AJ,0) - This looks for your input value in column AJ and returns a number, that number is the row number. you will need to select the whole column or the match rows wont line up with the real row numbers
c3 would be the input for your vlookup, or (index match which is what I used)
INDEX(BW:BW,MATCH(C3,AJ:AJ,0))) this is an index match that returns the value of BW you looked up into the price cell on sheet B. It will show as the text
Related
I need to explain how the workbook is designed so that the formula I'm trying to use makes more sense.
The workbook I'm trying to get data from has dates that run horizontally at the top and holidays for specific countries for a given date written vertically in adjacent cells. Countries will not always be located in the same row and not everyday will have the same number of countries for the previous day(s). For example, using letters to represent arbitrary row and column numbers,
workbook1
col a col b col c
row 1 1/1/2017 1/2/107 1/3/2017
row 2
row 3 Spain Canada Australia
row 4 Colombia Spain Vietnam
row 5 Vietnam England
In another workbook, I have something like:
workbook2
col a col b col c col d col e
date date column no date column letter code Spain
1/1/2017 a x ="'[workbook1.xlsx]sheet'!$" & x & ":$" & x
In the date column no column, I have a formula that gives me the column number from the first workbook where the date to the left exists. Using this number, I convert it to its equivalent in letters under the date column letter column. Using this, I was trying to build a dynamic MATCH formula in workbook2 which would just tell me if it found the country in the first workbook. The match formula would be placed right under "Spain" and be written =MATCH(E2, D2, 0). This doesn't produced the desired results. I'm not sure than writing the external reference as a string in column d of workbook2 and feeding it to the formula is making it work.
There is no need for all these helper columns and no need to translate a column number into a column letter. If you use Index, you can build a range based on the column number.
=MATCH(E1,INDEX([Workbook1.xlsx]Sheet1!$3:$3,MATCH(A2,[Workbook1.xlsx]Sheet1!$1:$1,0)):INDEX([Workbook1.xlsx]Sheet1!$20:$20,MATCH(A2,[Workbook1.xlsx]Sheet1!$1:$1,0)),0)
This formula has been applied in cell E2 of the workbook in the foreground. Workbook1 is in the background. The formula builds a range using two Index formulas. The first one finds the correct column and returns the cell in row 3. The second index finds the correct column and returns the cell in row 20. The two returned ranges are then combined into a contiguous range with the ":" operator. The range is now the correct column, row 3 to row 20. This range is then fed into the Match function which tries to find "Spain" or the value of cell E1 in that range.
Note that Workbook1 must be open for the formula to work. If it is not open, the formula returns the #Ref! error.
If the country in E1 is not found in the range, the formula returns the #N/A! error. You can suppress this by wrapping the whole formula into an IfError or IF(IsNumber(theformula),"found","not found")
Im just trying to make a basic spreadsheet to track investments and it currently has 2 sheets. 1 sheet refreshes data from a website and the other sheet is a calculation sheet.
In the calculation sheet the following Vlookup is present
=VLOOKUP(A3&"*", 'Refresh This File'!$A$2:$H$101, 1, FALSE).
In the cell A3 the input currently is Ethereum, and the table array has the string EthereumEthereum in row 2 Col B 2nd Sheet. (the 1 argument is the row label in the other sheet)
Currently with the above formula i am getting a #N/A error.
Is there any way where i can type a partial string in the input sheet, and return the associated row num from the other sheet.
Thanks for your help! :)
For VLOOKUP to work, the column in which you are looking your lookup value from should be column 1.
However you can use INDEX combined with MATCH if this is not the case:
=INDEX('Refresh This File'!$A$2:$A$101,MATCH(A3&"*",'Refresh This File'!$B$2:$B$101,0))
I have a "Master" sheet with part numbers in column A and locations in column B. I have approx 200 sheets with just part numbers in column A. How can I apply VLOOKUP to all sheets so every part number on every sheet will have my location in column B? It will take forever to do it manually. Thanks
Here is one way to achieve a lookup of data from the Master Sheet, assuming the starting cell containing your lookup value is A2. This also assumes that all sheets are in the same workbook:
=VLOOKUP(A2,Master!$A$2:$B$11,2)
An explanation of what each argument does from left to right:
A2 - cell containing lookup value in one of the 200 sheets. (This can be any cell which contains a lookup value).
Master is the name of the sheet which contains the data to look up.
$A$2 is the top left cell for the table data to look up in the Master sheet, we want to use $ sign because the lookup table top left cell should be fixed.
$B$11 is the bottom right cell for the table to look up in the Master sheet, we want to use $ sign because the lookup table bottom right cell should be fixed.
2, this is the column index which includes value you want returned for a successful look up. The column index starts at 1 and increases to the right, The column at index 1 contains the lookup values. In your scenario, index 1 is Column A and specifying an index of 2 will index column B
To deal with blank cells or cells which are not found in the table you can extend this formula like so:
=IF(ISNA(VLOOKUP(A2,Master!$A$2:$B$11,2)),"",VLOOKUP(A2,Master!$A$2:$B$11,2))
This formula will do the lookup, if it does not find the value it is looking for it will leave the cell blank, otherwise it populates the cell with the found data.
You can now copy and paste to cell A2 (or replace A2 with starting cell) and then drag the formula down the column to the last cell that requires VLOOKUP from the data table in the Master sheet. For every row X, it will update the lookup return data for the corresponding lookup value.
You will need to copy the formula then drag it to fill the entire B column for each 200 sheets which is a bit tedious. An alternative is to write a macro which loops over each sheet in the workbook and populates the corresponding column with the result of the lookup from the Master sheet.
VLOOKUP works when the lookup value is in some column X and the value to return, the data, is to the right of X.
If the data to be returned is to the left of the lookup value, you must use a combination of MATCH and INDEX which is slightly more complicated.
To lookup data in a different workbook, you will need to create a link between the two workbooks, this article explains how to do so.
Think about changing all your data to a single sheet. You may try this home made function:
Function AllSheetVLookup(ByVal lookup_value, ByVal search_col As Long, ByVal return_col As Long, Optional book_rng As Range)
Dim ws As Worksheet, r As Long
On Error Resume Next
For Each ws In IIf(book_rng Is Nothing, Application.Caller, book_rng).Worksheet.Parent.Worksheets
r = Application.WorksheetFunction.Match(lookup_value, ws.Columns(search_col), 0)
If r Then AllSheetVLookup = ws.Cells(r, return_col): Exit Function
Next
AllSheetVLookup = CVErr(2042) 'Not found, #N/A! returned
End Function
lookup_value - value to search, has in VLOOKUP;
search_col - column number in worksheets where to search for value
return_col - column number to return value from matched with match
book_rng - optional. Cell in another book if another book is to be searched. If ommited, book where function is called is used.
Example:
=AllSheetVLookup("part_number", 1, 2)
Will search for value "part_number" in column A (1st) from all worksheets of current book, and return value of column B (2nd).
I have found VLOOKUP and it does not seem to match all of the criteria I need to perform.
The following is what has stopped me at this time. I would appreciate any assistance.
in excel, I need to match a value from a specific cell in spreadsheet A, column B, with a range of values in spreadsheet B, column C. Then in the row that the value in spreadsheet B is found, I need to obtain the value for the cell in column P and copy it into spreadsheet A column N.
Thank you,
While VLOOKUP has its uses I would always recommend using the INDEX function instead as you are not limited by using the leftmost column.
I think the type of formula you are looking for is (to be put in column N of spreadsheet A):
=INDEX('[Spreadsheet B]Sheet1'!P:P,MATCH(B1,'[Spreadsheet B]Sheet1'!C:C,0))
This would match the specific cell of B1 in Spreadsheet A with a value in column C in Spreadsheet B and then give provide the value in column P of the corresponding row. Obviously you should change out 'Spreadsheet B' with the name of your workbook and 'Sheet1' for the name of the worksheet in Spreadsheet B.
I have a list of items on Sheet 1 with the names of each item in column A and then further information in the subsequent 5 columns.
On Sheet 2, in each of the cells of column A, I have set it so that I can pick any item from a dropdown list using data validation. I want the subsequent cells in the row to automatically assume the value of the respective cells in Sheet 1.
So if in Sheet 2, Cell A1 I select Item 3 (which is in Cell A3 on Sheet one), I want Cell B1 on Sheet 2 to have the same value as Cell B3 on Sheet 1.
I could get the result I wanted by using =IF($A3='Sheet1'!A3,'Sheet1'!B3,) and then adding each possible item but that seems really long winded and would require adding to the formula every time I added an item.
Any idea if there is a way of doing this? Sorry if my explanation is a bit confusing. My excel knowledge is not great!!
Thanks in advance
Use the Vlookup function
Next to your data validation cell, enter (assuming the first sheet called Sheet1):
=Vlookup(a1,Sheet1!a:f,2,0)
This will return the data that match for the 2nd column. For the 3rd use:
=Vlookup(a1,Sheet1!a:f,3,0)
And so on..