I have a sheet in which I store information about many variables (call this the reference sheet). I then have another sheet where I want to populate a column based on IDs from this other sheet, and then reference the other columns in the sheet depending on which ID is selected (either directly by pulling the values in - this may be easiest, or indirectly by using the values in a formula).
Example:
Reference Sheet:
What I'd like to create:
Where the id "C" was created using Data Validation from the Reference Sheet ID column. What I want is for Var1 - Var3 to be created by referring to the row in the reference sheet corresponding to "C". Alternatively, a calculation (in this case it's the sum of var 1 + var 2 divided by var 3) based on these values could be done in this sheet. Note: for this example, I just copied the output I want - but I do not know how to create this dynamically (which is my question).
Is this something that is possible in Excel? If so, how would I do that?
Assuming that the reference sheet is called sheet1, you can put this formula in the other sheet (in cell B2): =INDEX(Sheet1!$B$2:$D$6,MATCH($A2,Sheet1!$A$2:$A$6,0),MATCH(B$1,Sheet1!$B$1:$D$1,0)). Use the fill handle to copy the formula to the cells to the right (until D2).
And this formula in cell E2: =(B2+C2)/D2.
Related
[EXCEL] I am looking for a way use an IF function that refers to a column that is referring to a sheet.
EX:
NOTE: yellow box is what I want to have happen using the function
The ID column is populated from a separate sheet in my workbook
Formula:
=Sheet2!$A$3:$A$48
=Sheet3!$A$3:$A$48
I want the Flag column to refer to the ID column from the other worksheet. In pseudocode:
"If ID field references the Sheet2 Range, return value 1, ELSE, return 0".
Building on #BigBen's comment try this:
=IF(ISNUMBER(SEARCH("Sheet2",FORMULATEXT(A2))),1,0)
replace A2 with cell reference that matches the location of ID # 123456 in your spreadsheet, and then drag the formula down.
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..
I have a table of data in one worksheet and some analysis in a second. In the 'Data' worksheet each row contains a name and then a range of values (numerical). What I need to do is look across each row and where, for example, columns PN and PM both contain a 1 return me the name in column M. This list needs to then grow as I add more data to the table in 'Data'.
Hopefully that makes sense. I am doing something similar with a single value lookup using the below but cannot get it to work for multiple values:
=IF(ISERROR(INDEX(Data!$A$4:$QQ$4999,SMALL(IF(Data!$A$4:$QQ$4999=$J$6,ROW(Data!$A$4:$QQ$4999)),ROW(1:1))-1,13)),"",INDEX(Data!$A$4:$QQ$4999,SMALL(IF(Data!$A$4:$QQ$4999=$J$6,ROW(Data!$A$4:$QQ$4999)),ROW(1:1))-3,13))
I copy this down and then when the data is updated the blank cells are automatically populated. The new formula I need is similar to this, but rather than looking up one value J6 in the above, I need to lookup two.
I would use a helper column. Pick an unused column, say column QR and in cell QR4 enter:
=IF(AND(PM4=1,PN4=1),1,0)
In QR5 enter:
=IF(AND(PM5=1,PN5=1),1+MAX($QR$4:QR4),0)
and copy downward.
This column assigns a simple sequential value for each "collectable" row. For example:
Then in the other sheet, pick any cell and enter:
=IFERROR(INDEX(Data!M$4:M$4999,MATCH(ROWS($1:1),Data!QR$4:QR$4999,0)),"")
and copy down to collect the data:
I need to pull data from a cell on another sheet (Sheet1), using a variable on the Current sheet (Sheet2, 3, 4 etc)
..ie I have a formula that takes the current sheet name and returns a value in a cell (A1 on current sheet),
I then need to go to a specific Column on another sheet but using the Row as derived from the sheet name something along the lines of:-
=Sheet1!H(Sheet2!A1)
where H is the column and (Sheet2!A1) is the row, and A1 holds the value of the current sheet name
Take a look at the Excel INDIRECT function, it might do what you're looking for. It takes a string (which you can build) and used the value of the string to make a cell reference.
http://office.microsoft.com/en-001/excel-help/indirect-HP005209139.aspx
I have some data that's structured in a table like this:
.
I have another tab on my spreadsheet where I eliminate any duplicate category entries and want to concatenate the data to look like this:
I need to create this using a function and not a macro or Visual Basic. I've already written the function to eliminate any of the duplicate category entries and now I need to figure out how to take each of those unique categories and append the data behind it. Any ideas?
Assuming the first image comes from Sheet1 and the second Sheet2, here's a way to do it. You need to add at least one calculated column to Sheet1 and optionally two calculated rows to Sheet2.
Uniquely identify each row on Sheet1. Add a new column A with the formula =B3&COUNTIF($B$3:B3,B3) in A3 and fill down. You'll have first1 in A3, first2 in A4 and so on.
Identify each block of columns on Sheet2. Add a new row 6 with the formula =COUNTIF($B$2:B2,B2) in B6 and fill across. The values will be 1,1,1,2,2,2,3,3,3. You can type these in manually if you like but it won't scale as easily.
Work out the column of each data item in Sheet1 and put in the columns for Sheet2. Add a new row 7 to Sheet2 with the formula =MATCH(B2,Sheet1!$A$2:$E$2,0) and fill across. The values will be 3,4,5,3,4,5,3,4,5. We now know, for each cell in Sheet2, which instance of the category we have and in which column the data variable comes from.
Use VLOOKUP to find first1 and return data column 3 within the data table. On Sheet2, set cell B3 to =VLOOKUP($A3&B$6,Sheet1!$A$2:$E$8,B$7,FALSE) and fill down and across.
You'll have a number of #N/A errors (e.g. cell E4). If you have a newer version of Excel, you can use IFERROR() to escape this; otherwise, use =IF(ISNULL(<formula>), "", <formula>) where <formula> is the formula in step 4.
To summarise:
Create a unique, sequential, calculable row ID for each row in the source.
Determine which instance of that sequence is used by each column in the destination. This is appended to the end of the category to determine the row IDs formed in the previous step.
Determine which column contains the data for each column in the destination.
Look up the row with the calculated row ID and find the relevant column for this data item.
Format the results appropriately.