Excel using proper formula, Lookup vs Vlookup vs IF - excel

Trying to write a formula for Excel, Using 2 worksheets. to classify the invoices
Worksheet 1 has Group Name and Group ID
Worksheet 2 has Group Name, invoice amount,invoice number
Trying to get the Group ID to worksheet 2, keeping in mind a ID can be use multiple times
Using formula below but the IDs I'm getting back aren't matching
=LOOKUP(F2,GROUP!C:C,ID!B:B)
Any help would be appreciated

Assuming GroupName is column 1 of Worksheet2 and that GroupName and ID are in columns A and B, respectively in Worksheet1
Place this formula in B1 of Worksheet2:
=vlookup(A1,Worksheet1!A:B,2,0)
Update all cell references and placements as they match your actual sheet data.

With vlookup you have to be sure that your data is first sorted, otherwise the algorithm tends to fail.
A better alternative, in my experience, is to do something like the following. I am assuming that Worksheet 1 has Group Name in Column A and Group ID in column B, and that Worksheet 2 has Group Name in column A. This formula would go in worksheet 2, in a blank column starting in row 2:
=index(Worksheet1!B:B, match(A2, Worksheet1!A:A, 0))
If you fill that equation all the way down, then it will perform the equivalent to a vlookup but without the need to sort your data first.

In Worksheet2:
=Vlookup(F2,Worksheet1!B:C,2,False)
But it would be better to size the table exactly and not refer to the whole column, like:
=Vlookup(F2,Worksheet1!B1:C200,2,False)

Related

Excel copy contents from one sheet to another without VBA/Macro

I've tried to use the search function but I can only find VBA related entries. I am looking for something without VBA. Maybe a simple formula?
OK I have a sheet with more than 8000 entries from Column A to L
In each column there's an entry like name, date, region etc.
Then I have other sheets with Region, let say Region 1, Region 2 etc.
I want to copy the entries from the main sheet belonging to Region 1 to the Sheet Region 1, the entries from Region 2 to Sheet Region 2.
So for testing I created the following Index/Match formula
=index(Sheet1!A:L, MATCH(Admin!$E$1,Sheet1!F:F,0))
Sheet1 A:L = Area to search for
Admin E1 = Value to look for
Sheet1 F:F = Where to find the value to look for in main sheet
But when I pull this formula down into the next row, it gives me the exact same entry again (like duplication) and it does not continue looking for the next item in the sheet.
What am I overseeing here? Am I using the right formula?
Thanks for your help in advance!
Yes, you could use INDEX/MATCH or VLOOKUP formulas. A simpler way to do it would be to use the FILTER function. Let's pretend the table with yellow headers is your main sheet. The table with blue headers is the sheet "Region 1".
Formula :
=FILTER($A$1:$L$11,$G$1:$G$11=1)
A1:A11 is the main table, G1:G11 the cells containing the region values. We keep the records when region=1. So in each sheet "region", you'll have a FILTER formula in A2 (assuming you keep line 1 for the headers).

How can I reference values dynamically from 3 columns in another sheet based on a value in cell?

I have a dropdown list of 104 values in column F. I want if any of the values is selected from that list cloumn, a corresponding value should be referenced from sheet and be inserted the cell in Column i .
If a value is selected in sheet 1 column F then it should match it with a similar value in sheet 2 columnA and also select the value corresponding value in Sheet 2 column B and go back and insert it in sheet 1 Column i.
Please note that each of the 104 values in column F has its corresponding value from a cell address of another worksheet
worksheet with dropdown list column F and inserted value column I
worksheet with referenced value
use Index/Match
=Index("select the data that you want displayed",match("common data", "common data",0))
I use this a ton when pulling data from multiple tabs.
=index(List of Customers,match(tab1_CustomerID, tab2_CustomerID,0))
hope this helps!
That calls the use of two possible functions:
The first is VLOOKUP, which you can find about in here:
https://exceljet.net/excel-functions/excel-vlookup-function
(please note the 4th parameter!!!!)
The second combination is index/match, which I think is more appropriate for your situation:
https://www.ablebits.com/office-addins-blog/2014/08/13/excel-index-match-function-vlookup/
Or here:
https://exceljet.net/index-and-match
Less theoretical but with the best explanation:
http://www.randomwok.com/excel/how-to-use-index-match/
more complicated but fits your purpose better
Index/match with more than one column to match against:
https://www.deskbright.com/excel/index-match-multiple-criteria/

Formula - find and copy from sheet 1 to sheet 2

In Excel, I have sheet 1 with column a (ID numbers) and column b (contract numbers), and sheet 2 with column a (ID numbers).
I need to find the ID numbers from sheet 2 in sheet 1, and copy the relevant contract numbers in sheet 2 (in a new column).
Can you please help with the formula?
Sounds like you could use the VLOOKUP formula for this. The VLOOKUP formula will look for a specified value in the left-most column of a table or range, and then returns a value from the same row of a column you specify.
For example, say you have the following on Sheet 1:
You would then use the VLOOKUP formula on Sheet 2 to find the ID in Sheet 1 and return the correlated Contract, like so:
You could use a "vertical lookup" function in your second sheet. Use something like the pseudocode below in the cell you want the information to appear in the second sheet .. where column 2 contains the information "looked up" in sheet one that you want.
=vlookup(-cell reference containing ID in second sheet-,-reference to all of sheet 1-,2,false)

Assign a unique number to every unique product number in excel

I have two sheets. Sheet1 has a list of products and Sheet2 has a list of products and their location. Since the product can be in multiple locations, there are a good amount of duplicates in Sheet2.
There are 26,000 products. I have assigned each product a number in Sheet1, 1-26,000. Is there a way for me to assign each number to the correct product in Sheet2?
This is a example of what I need:
The top table would be Sheet1 and the bottom table would be Sheet2, the one with duplicates.
This is what they look like right now:
Sheet1:
Sheet2:
Please let me know if I did not explain this well enough. I appreciate your help!
copy your column A in sheet 1 to column c
Then in your sheet 2 column C row 2, use =vlookup(B2,'sheet1'!B:C,2,0)
(if your first item is in B2)
Drag your formula down and it should work.
Use VLOOKUP or the INDEX MATCH combo formulas in the second sheet to locate the ITEM IDs in the first worksheet
If you're Item ID's are sorted the way you illustrate it, then you can simply use an IF formula:
For example you have a data as shown:
Enter this formula in A2:
=IF(B2=B1,IF(ISNUMBER(A1),A1,1),IF(ISNUMBER(A1),A1+1,1))
Above formula will give you what you've described.
Again, your items should be sorted so that same Item ID are in order.

Using vlookup in Excel to match a Surname and First name and output unique ref number?

I have a spreadsheet which has 3 columns
Col A is a unique reference number
Col B is the surname
Col C is the firstname
In another worksheet I want to be able to type in a surname in cell A2, a firstname in cell A3 and have cell A1 automatically populated with the unique reference number.
Is this possible in Excel and if so could you give me an example of how to do it?
Thanks,
Greg
VLOOKUP requires that the data that you're looking up is in the first column and that the range is sorted by that column.
If that's not an issue, then you could shift your columns on your source sheet to the right and put in a new column containing something like =CONCATENATE(upper(C1)," ",upper(D1)) into the new column A - then use VLOOKUP against that column. (this is what Kaloyan said).
Otherwise you could put your concatenated, capitalised column and index on another (hidden) sheet and run your vlookup against that range.
Most straightforward way would be to combine the two names in another column like so: =upper(B1)&" "&upper(C1). Then you can do a vlookup on those values to get the unique ref #.

Resources