I have a series of drawing numbers, with the first 3 characters being the unit. I have tabs with the tab name as the unit.
EG: drawing - 003/123, tab name 003.
I need to look up the drawing number on the relevant unit tab and return a value. I assumed this would be something simple like =vlookup(A2,"'"&left(A3,3)&"'!"&A:B,2,false), but it's not working. It's returning #VALUE.
Can you help? I've tried putting the A:B range in the quotes too.
So, the data would be something like...
001/111 A
002/002 D
003/441 Z
There's a tab for 001, 002, 003 etc. with various drawing numbers, and I want to pull the above column B from the relevant tab who's tab name is the first 3 characters of what's in column A..
I hope that makes sense. Thanks in advance.
What you are looking for is the volatile function INDIRECT().
Volatile means that the formula will recalculate after any change is made in any cell of the spreadsheet - if this formula is used en masse it can cause performance issues, if this occurs manual calculation may be required.
INDIRECT() reads a string that represents a cell reference as a cell reference:
Your final formula will look something like this:
=vlookup(A2,INDIRECT("'"&left(A3,3)&"'!A:B"),2,false)
Related
I have an Excel file which includes lots of rows of information. I have actually a single problem which is I can't get the parent of each cells according to the information in the cell. It looks like this
In the image, you can see that A has no parent and its' children are A01 and AB and more and more like AC and AD. Is there any way for handling this issue with excel-formulas?
Assuming that your sample data is true to the format of all your data (there is either 2 numbers at the end of each parent or only an extra letter) then the following formula will work:
Given formula is set to look at data in cell A1, you will have to drag and auto fill the formula down for all rows.
=IF(OR(RIGHT(A1,1)="0",RIGHT(A1,1)="1",RIGHT(A1,1)="2",RIGHT(A1,1)="3",RIGHT(A1,1)="4",RIGHT(A1,1)="5",RIGHT(A1,1)="6",RIGHT(A1,1)="7",RIGHT(A1,1)="8",RIGHT(A1,1)="9")=TRUE,LEFT(A1,LEN(A1)-2),LEFT(A1,LEN(A1)-1))
It works by checking if the last character is a number (with this data excel treats it as text so we have to check for each number as if it is text), if it matches a number then show the parent minus the two right characters otherwise show the parent minus one character.
Okey I think I found the answer. Here is my formula
=IF(LEN(B2)=1;"NULL";IF(LEN(B2)=2;LEN(B2;0);IF(LEN(B2)=3;LEFT(B2;1);IF(LEN(B2)=4;LEFT(B2;3);IF(LEN(B2)=5;LEFT(B2;4);IF(LEN(B2)=7;IF(B2;5)))))))
With this formula, I check the length of the characters in cell and get the first part of that string instead of deleting the last indexes because of there are also some string values.
Because of there are some rules with my product codes, I figured out how they are changing and I got the part of the code by their sizes. Thanks for replies, they helped to find this solution.
I keep thinking there must be a function that allows an address within a cell to be used as a variable within another cell address. For the types of sheets I'm creating it would make my life so much easier.
For the purposes of example, the function I seek is hypothetically called "THING" below:
Sheet1 Daily Menus
MONDAY MENU
Items: Helper Column Nutritional Data Results
A B C
1 =Sheet2!A35 =THING(A1,row=35) =INDIRECT("Sheet3!G"&B1) =Sheet3!G35
2 =Sheet2!A247 =THING(A2,row=247) =INDIRECT("Sheet3!G"&B2) =Sheet3!G247
3 =Sheet2!A989 =THING(A3,row=989) =INDIRECT("Sheet3!G"&B3) =Sheet3!G989
TUESDAY MENU
101 =Sheet2!A613 =THING(A101,row=613) =INDIRECT("Sheet3!G"&B101) =Sheet3!G613
The bottom line is:
In a complex spreadsheet (10 pages, each with hundreds of rows and columns), I want to manipulate the addresses by altering only the data in column A on page 1.
This would also allow me to easily copy column B down for hundreds of rows. The type of function in column B may also be required in columns C, D, E... for dozens or hundreds of columns.
Right now I'm typing in each needed address manually, or a very long function using the address. If anything changes in column A then I have to go back and retype these long functions... and often I find that I've made a typo with all that typing...
You seem to have as your starting point formula =Sheet2!A35 in cell A1.
What you have to do is:
Get the formula as a string.
For this you can use either XL4 macros, VBA, or FormulaText (in Excel 2013 or later), see this.
Extract the row number from the string.
For this you an use VBA (very easy), or a formula to find the rightmost letter/$ and keep the substring to its right.
Use the previous answer, as you already incorporated in your question.
Answer to the first version of the question
I will split the formula you are looking for in two steps.
In cell B1 you can enter ="Sheet2!"&"X"&TEXT(A1,"0").
This will produce the result Sheet2!X25.
Then in cell C1 you can enter =INDIRECT(B1).
This will bring into cell C1 the contents of cell Sheet2!X25.
Notes:
You can copy the formula downwards as you need.
When copying into other columns, take care of relative/absolute indexing.
You could use a single formula (no helper column) in B1: =INDIRECT("Sheet2!"&"X"&TEXT(A1,"0")).
Both Sheet2 and (column) X could be replaced by suitable formulas if you want them not be hardcoded.
Formula in B1 can almost certainly be replaced by
="Sheet2!"&"X"&A1.
NB: A long time time ago, under circumstances I do not recall now, I found I needed to use TEXT; YMMV.
I am looking to get some help with a function that I am sure is an option but I sadly have no clue on how to implement.
Basically, I'd like a formula to go from C21:C50 and look for the top two values. Based upon which two are the top, it would reference the name in B column and populate that value in the another cell (the cell the formula resides in)
If you look at the image, in the primary field, we'd have Steve. Secondary would be Alan.
Is this something anyone can help with? I simply am lost :(
Try
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7,ROW(A1)),$C$3:$C$7,0))
with Bob in cell B3 and the "primary" formula in cell C9. Copy down to cell C10.
If dealing with integers, you can simply add +1/ROW([range]) to avoid doubles:
=INDEX($B$3:$B$7,MATCH(LARGE($C$3:$C$7+1/ROW($C$3:$C$7),ROW(A1)),$C$3:$C$7+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
However, this may fail for numbers like 5.01 or 4.99. For that case just use it in combination with RANK.EQ:
=INDEX($B$3:$B$7,MATCH(LARGE(RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),ROW(A1)),RANK.EQ($C$3:$C$7,$C$3:$C$7,1)+1/ROW($C$3:$C$7),0))
This is an array-formula and must be confirmed with ctrl+shift+enter!
The steps as picture:
The first table shows the direct adding of 1/ROW which is used for LARGE and MATCH to get the row if doubles exist (so INDEX can pick the correct one)
The second table shows how the values get replaced by their rank with RANK.EQ and then are treated the same like the first table.
The third (grey) table shows, what would happen if the first formula is applied to the second table (to demonstrate how the ranks get messed up).
For Excel 2007 just replace the RANK.EQ($C$3:$C$7,$C$3:$C$7,1) with RANK($C$3:$C$7,$C$3:$C$7,1).
If you still have any questions, just ask :)
Can Not Get My VLookUp In Excel To Return The Requested Data
I am trying to pull data from another sheet based on data selected from a dropdown on the main sheet.
All the formatting is "General"
=VLOOKUP(F15737,'Location Master'!$A:$J,2,FALSE)
It just keeps returning me #N/A
Try using the Index Match method. It's an alternative to Vlookup which doesn't require data to be sorted and can therefore be of more use.
The typical structure of this method is (the text inside the asterisk will give the ranges specific to your sheet:
=INDEX (**Column from which you want to return a value**, (MATCH(**Lookup Value**, **Column against which you want to lookup**,0))
In this case, if I've understood your workbook structure, the formula should look like this:
=INDEX('Location Master'!$B:$B,(MATCH(F15737,'Location Master'!$A:$A,0)))
This is a common problem with VLOOKUP(). Most likely you have some whitespace (A tab character or some spaces) after one of the values. Click on F15737 and see if there are any spaces at the end of it. Likewise, manually find the value in 'Location Master'!$A and check it for spaces or tabs after the value.
If the whitespace is found in F15737 then you can change your vlookup to be:
=VLOOKUP(TRIM(F15737),'Location Master'!$A:$J,2,FALSE)
If the whitespace is in the range to which you are looking up, then you'll need to trim all of those values, which you can do pretty quickly in a new column with the TRIM() formula.
If this doesn't solve the problem then you might have a number stored as text. Generally excel will tell you if this is the case within the cell with a little green corner indicator. To get Excel to automagically change a column from a "Number stored as Text" to a proper number you can:
Highlight the column
Go to Data>>Text To Columns
Click "Fixed Width"
Click "Finished"
Excel will then format everything automatically (dates to dates, numbers to numbers, text to text, time to time, etc.)
I have a spreadsheet that I am using as a questionnaire.
One of the questions is Who are your wheel suppliers (mark all that apply)? and there are 6 check boxes in column C to select 5 different wheel suppliers and an Other option. I have these check boxes linked to return whatever suppliers name is selected in the cell adjacent to the cell the check box is in in column I.
So depending on what wheel suppliers the customer selects there could be anywhere from 1-6 different suppliers selected. So once the customer has selected the wheel suppliers whatever suppliers are selected will show up in the correct cell in range I45:50.
What I am having a problem with is that I need these to pull into a data tab into one cell. I am having a problem coming up with a formula to put all the suppliers together as a list in one cell with commas separating each. Remember, it could be 1 supplier, could be 3, could be 6.
Any advice is much appreciated. I have tried using If formulas and Concatenate but I can't seem to figure out how to get it to work like I want it to.
=CONCATENATE(Questionnaire!I45," ",Questionnaire!I46," ",Questionnaire!I47," ",Questionnaire!I48," ",Questionnaire!I49," ",Questionnaire!I50)
That is the best I've come up with but the problem with it is if the first supplier isn't selected then it will enter that space anyways and if the first supplier and the last supplier are selected it will have all those spaces in between.
Another method, this one using helper cells.
Say you have the data in A1:A6. In B1, input this formula: =IF(LEN(A1)>0,A1&",",""). Drag down to B5.
In B6, slight variation: =IF(LEN(A6)>0,A6,",""").
In C1: =CONCATENATE(B1,B2,B3,B4,B5,B6).
What happens is the cells in the B column checks if their respective values in the A column are not blanks. If not, they will append , to it. Otherwise, they will return blanks (not spaces). The only variation is B6--since it's the end of the list, there's no , appended to it.
It's only a matter of concatenating them at this point. Removing any of the values in A, maybe by unchecking their checkbox, will reflect the change in C1 properly.
Let us know if this helps.
EDIT:
To accommodate your formula, change your CONCATENATE formula to something like below:
=LEFT(CONCATENATE(...),LEN(CONCATENATE(...)-1)
What is does is it removes the rightmost character by getting, from the left, all the characters up until one less than the length of the result. Obviously, fill in the ... with the ranges you want to concatenate.
Let us know if this is what you need.
FURTHER EDIT:
=LEFT(CONCATENATE(Questionnaire!F45,Questionnaire!F46,Questionnaire!F47,Questionnaire!F48,Questionnaire!F49,Questionnaire!F50),LEN(CONCATENATE(Questionnaire!F45,Questionnaire!F46,Questionnaire!F47,Questionnaire!F48,Questionnaire!F49,Questionnaire!F50))-1)
Looks ugly, right? But does the job. Better if you use a named range, though, like below:
Now it's much shorter. Error on my end is because I don't have Questionnaire sheet, obviously.
If J44 is blank and you are prepared to add something like =IF(ISBLANK(I45),J44,J44&I45&", ") in J45 (copied down) then perhaps:
=SUBSTITUTE(LEFT(wheelC,LEN(wheelC)-2),0,"")
might suit, where wheelC is a named range of workbook scope for Questionnaire!J50.