Using an IF function to refer to separate sheet - excel

[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.

Related

Reference a filename from another cell in Excel [duplicate]

I am trying to use the indirect function in Excel to build a formula to return a value on another sheet.
On Sheet A cell D3 has the value B
I want to use the value B to return a value from cell B6 in a Sheet called App Summary.
I tired the below formula on Sheet A:
="'App Summary'!"&Indirect("D3") & 6
This return the string 'App Summary'!B6.
How do I get it to calculate so that is returns the value in cell B6 from the App Summary Sheet?
I usually put the whole statement in the Indirect() function and use '&' to connect parts that are direct quotes with parts that are dynamic.
Example: =INDIRECT("'Workbook A'!A"&A1) will return the value in 'Workbook A'! that is located in column A, at the row indicated by the number in the current sheet's A1. If A1 is 1, this will return the value in 'Workbook A'!A1.
You might try =Indirect("'App Summary'!"&D3&"6"). I'm assuming you want to use a column from another sheet who's value is stored in D3 of the current sheet and look in the 6th row on the Summary sheet.

Reference other cells based on value from dropdown list

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.

I am using vlookup across 2 spreadsheets. The formula appears to be correct, but the value is not returning, only the formula displays

I am using 2 spreadsheets. Sheet1 -Return Codes needs the values from Sheet 2- GL Interfaces. I am trying to match with column 1 on sheet 1 to sheet 2 in order to bring back the correct Name associated with an application ID.
The formula displays in the cell instead of the value replacing the formula:
=VLOOKUP(A2,'GL Interfaces'!A2:F61,2,False). What is wrong with my formula for this simple lookup?
I click in the column where I want the value to return to.
Click Formula | select Vlookup.
Click on A2 (the column with the application numbers) on sheet 1
Go to second sheet and highlight array that I want to be searched.
Put in 2 as a column with the Names (col index num) that I want to be searched on the second sheet
Enter False for the last entry (Range_Lookup)
Enter and only the formal displays in the cell I want a Name to appear.
What am I doing wrong?
=VLOOKUP(A2, 'GL Interfaces'!A2:F61, 2, false)
is a valid formula. make sure that the first column of the 2nd argument of vlookup is the one that contains the value from the first argument of vlookup. in other words: A2 needs to be found in A column of sheet GL Interfaces and if there is a row with a match, then return value from B column of GL Interfaces sheet

Indirect Function to Build Excel Formula

I am trying to use the indirect function in Excel to build a formula to return a value on another sheet.
On Sheet A cell D3 has the value B
I want to use the value B to return a value from cell B6 in a Sheet called App Summary.
I tired the below formula on Sheet A:
="'App Summary'!"&Indirect("D3") & 6
This return the string 'App Summary'!B6.
How do I get it to calculate so that is returns the value in cell B6 from the App Summary Sheet?
I usually put the whole statement in the Indirect() function and use '&' to connect parts that are direct quotes with parts that are dynamic.
Example: =INDIRECT("'Workbook A'!A"&A1) will return the value in 'Workbook A'! that is located in column A, at the row indicated by the number in the current sheet's A1. If A1 is 1, this will return the value in 'Workbook A'!A1.
You might try =Indirect("'App Summary'!"&D3&"6"). I'm assuming you want to use a column from another sheet who's value is stored in D3 of the current sheet and look in the 6th row on the Summary sheet.

How to import data from one sheet to another

I have two different work sheets in excel with the same headings in in all the row 1 cells(a1 = id, b1 = name, c1 = price). My question is, is there a way to import data(like the name) from 1 worksheet to the other where the "id" is the same in both worksheets.
eg.
sheet 1 sheet2
ID Name Price ID Name Price
xyz Bag 20 abc 15
abc jacket 15 xyz 20
So is there a way to add the "Name" in sheet 1 the "Name" in sheet 2 where the "ID" in sheet 1 = "ID" in sheet 2?
Without coping and pasting of course
Thanks
VLookup
You can do it with a simple VLOOKUP formula. I've put the data in the same sheet, but you can also reference a different worksheet. For the price column just change the last value from 2 to 3, as you are referencing the third column of the matrix "A2:C4".
External Reference
To reference a cell of the same Workbook use the following pattern:
<Sheetname>!<Cell>
Example:
Table1!A1
To reference a cell of a different Workbook use this pattern:
[<Workbook_name>]<Sheetname>!<Cell>
Example:
[MyWorkbook]Table1!A1
Saw this thread while looking for something else and I know it is super old, but I wanted to add my 2 cents.
NEVER USE VLOOKUP. It's one of the worst performing formulas in excel. Use index match instead. It even works without sorting data, unless you have a -1 or 1 in the end of the match formula (explained more below)
Here is a link with the appropriate formulas.
The Sheet 2 formula would be this: =IF(A2="","",INDEX(Sheet1!B:B,MATCH($A2,Sheet1!$A:$A,0)))
IF(A2="","", means if A2 is blank, return a blank value
INDEX(Sheet1!B:B, is saying INDEX B:B where B:B is the data you want to return. IE the name column.
Match(A2, is saying to Match A2 which is the ID you want to return the Name for.
Sheet1!A:A, is saying you want to match A2 to the ID column in the previous sheet
,0)) is specifying you want an exact value. 0 means return an exact match to A2, -1 means return smallest value greater than or equal to A2, 1 means return the largest value that is less than or equal to A2. Keep in mind -1 and 1 have to be sorted.
More information on the Index/Match formula
Other fun facts: $ means absolute in a formula. So if you specify $B$1 when filling a formula down or over keeps that same value. If you over $B1, the B remains the same across the formula, but if you fill down, the 1 increases with the row count. Likewise, if you used B$1, filling to the right will increment the B, but keep the reference of row 1.
I also included the use of indirect in the second section. What indirect does is allow you to use the text of another cell in a formula. Since I created a named range sheet1!A:A = ID, sheet1!B:B = Name, and sheet1!C:C=Price, I can use the column name to have the exact same formula, but it uses the column heading to change the search criteria.
Good luck! Hope this helps.

Resources