Copy data from another cell if criteria is met - excel

I have quite a problem. In the excel spreadsheets, I have a lot of data entered into one main spreadsheet and some of the into another.
In the main Spreadsheet (Sheet1), I have column L, that has tons of entries of unique numbers. Also, I have a column Q that stores another data for a lot of entries into the sheet.
In another sheet (Sheet2), I might have some of the entries that can be the same with the column L in the Sheet1, and they are stored in column D, on Sheet2. So, if those two sheets entries matches (L:L in Sheet1 with D:D in Sheet2), I want to have the Q entry from Sheet1 into my, lets say N column at Sheet2. If they don't match, blank would be ok.
I've been searching the solution for quite a time, found some on Microsoft official website, but I haven't been able to apply it.
This one was the closest solution I could find, but, since I'm newbie with Excel, I haven't been able to implement it correctly.
Edit:
To Illustrate a bit, here is exactly what I am looking for:
Lets say:
Sheet1
L2=115457; Q2=2148446
L3=381493; Q3=Blank
L4=121214; Q4=484846
L5=151515; Q5=Blank
Sheet2
D143=381493; N143=(need input from Q2)
D523=121214; N523=(need input from Q4)
D968=151515; N968=(Blank)
Thanks in advance.

Related

Build hyperlink with VLOOKUP [duplicate]

I have a status update sheet (sheet1) in which team members have a line per action, and each action has a reference number (s1, columnA).
In another sheet (sheet2), I have the team leads write their own status updates, but they may not necessarily reference every single reference number, nor will they do it in the same order as sheet1.
Basically, what I'm looking for is a column in sheet1 to show a link automatically IF the reference number in columnA sheet1 is also found somewhere in columnB in sheet2.
Is this possible? If so, how would I work this? I'm hoping to use a formula, but I'm not sure if that's possible. Hoping to use VBA as a last resort since this will be a shared spreadsheet and the probability that someone might screw it up is decent.
Thank you, and please let me know if I should clarify anything.
What you are looking for is a dynamic hyperlink.
So, let's assume that you have on Sheet1 all the
team members with the (column B)
team leads and the (column A)
reference / project numbers (column C).
On Sheet2 we have a table with various information and the same reference / project number in column E.
Then you can add a new column D to the table on Sheet1 which you might want to name Links and the formula here should be:
=HYPERLINK("#Sheet2!E"&MATCH(D2,Sheet2!E:E,0),"Link to "&D2)
If you are using tables with named columns that you can also use:
=HYPERLINK("#Sheet2!E"&MATCH([#[Reference Number]],Sheet2!E:E,0),"Link to "&[#[Reference Number]])
Of course you can adjust the alternative text to something more suitable.
Maybe the following picture helps explaining the above:

Complex INDEX/MATCH? Or VLOOKUP?

I have heard INDEX/MATCH is better to use across the board so I'm hoping this can be done with one of those functions, but I am having a heck of a time figuring it out on my own even though I've tried multiple things. I have a multi-sheet document. It is a list of approved fasteners so there are sheets for washers, nuts, screws, etc. I want to have a separate sheet to look up values based on the nominal size of the required fastener.
A1 on the working sheet will be where the nominal size is entered.
I need it to return multiple values from the washers sheet (we'll start with that one because once I have that, I can figure the rest out) because there will be numerous fasteners with the same nominal size. I also need it to ignore any rows where R exists in column J.
Basically,
If A1 on the working sheet = the value in column F on the WASHERS sheet (the column for nominal size) and there is no "R" in column J on the WASHERS sheet for that row, return the value from column C on the WASHERS sheet.
Use this formula:
=IFERROR(INDEX(A$1:A$14,SMALL(IF((B$2:B$14=F$2)*(C$2:C$14<>F$3),ROW(A$2:A$14)),ROW(1:1))),"")
This is an array formula and must be confirmed with
Ctrl+Shift+Enter.
This is how the formula related to data.

Excel, Compare values from different sheets, if they match return data from a third column

I admit that I am pretty new to using formulas in Excel, so i am looking for some help. I tried looking at some other examples of similar questions and tried working through it before asking here.
Onto the question: Basically I fairly large data set. I am trying to match Names on files with Names on the employee list and then auto-fill what department they work in.
On one sheet (Lets call it Sheet1) I have HR Data the includes their name (column A) and department (Column B). On another Sheet (lets call it sheet2) I have all the file names (Column A) I want to match it to. On sheet 2 I did a vlookup to match the names on the files with the names on HR (Column B), no biggie there. But now I want to basically say IF the Name matches on Sheet2 to Sheet1, pull the value from Sheet1 Column B into Sheet2.
I tried to use an IF originally, but it seems like IF statments dont let you use a range (match Sheet2 B2 to Sheet1 A:A) and wants to match exact cells (Say Sheet2 A2 to Sheet1 A2) if that makes sense? There are people with multiple files belonging to them in sheet 2, but they are only listed once in Sheet 1.
Thank you for the help.
Thank you all for responding. I know it was hard to follow what i was saying, and i really wish i could post up what im working with, however I work with PII and cant post it.
I was able to find an answer to my question with some more google searching and experimenting. If anyone has a similar problem to me, use the =INDEX funciton. The link below is what i used:
https://superuser.com/questions/669610/comparing-columns-in-two-different-excel-sheets-and-if-they-match-copying-third

Can I pull correct values for a variable from an old spreadsheet into a new one that's missing those values?

I have an excel spreadsheet with several columns, each representing different variables collected from various patients (rows). One of the columns is the unique medical record #, another is a unique visit identification #. The problematic one is "age." I must have inadvertently dragged and replaced the ages of about half of my subjects, since I doubt that >3000 of my 6000 patients are 54 years old.
I have the original file with correct ID# and age pairs, but I've done considerable work on this file and cannot start over. Is there a way in my new file to look at the ID# in column C, go to the old excel file, find that ID#, go over 3 cells to column F (age), copy that age value, go back to the new excel file and paste the correct age for each ID#?
I cannot simply sort both files by ID# and copy/paste all of the ages as a number of the cases have been intentionally removed and so the ID#s wouldn't match up because the total N is different.
I also have SPSS and R available to me, although I'm not particularly proficient with either.
Just, as an example, here's what the two spreadsheets look like:
http://imgur.com/OjZsLEJ
I've manually highlighted the bad values, but in reality there are 3000+ of them and manually checking would be very time consuming.
Thanks in advance!
A VLOOKUP function should work here:
=VLOOKUP(C3,[OldWorkBook.xlsx]Sheet1!$C:$F,3,FALSE)
If you place this function in Column C, Row 3 of the New Workbook and then change "OldWorkBook.xlsx" in the function to reflect the name of your old Workbook, it should return the correct value from your old Workbook.
You can then copy that formula and paste it into the remaining cells in that column.
If the values are correct, you can copy them, Right-Click and select "paste values" to solidify them in your new workbook.
If I've understood your question, that should fix the problem. If not, please let me know.
You can do that with a VLOOKUP formula.
It should look like this (check if the cell references are right, and also the file and sheet name).
You should put this in a new column in your "NewFile".
The formula references the "OldFile" and should bring the value for the "F" column in the "OldFile" whenever the values for the "C" column are the same.
This example would be for the second row of the file (I am assuming the first row are column headers).
=VLOOKUP(C2,'[OldFile.xls]Sheet1'!$C$2:$F$6000,4,FALSE)

Find and Compare Two Columns Excel (With Screenshots)

I have a spreadsheet that will occasionally get new data that I don't know the contents of, I just have to add it to the spreadsheet. Some of the new data is just updating rows that are already in the spreadsheet, and other data is adding new rows. I'm looking for a way to add a column that will tell me if something has changed in the row when I compare the old spreadsheet to the new one.
The sheets have one column that will always have a unique value among all the rows, so I can use that to match rows if the sheets aren't sorted the same way. Here are some screenshots to show what I'm trying to do:
Old Spreadsheet:
New Spreadsheet:
The only solution I can think of is a large nested IF formula that compares each column one by one, something like:
=IF(Old!B2=New!B2,IF(Old!C2=New!C2,"NO","YES"),"YES")
The problem with that is that it gets very hard to look at since my actual data is using 33 columns (not including this "Changed?" column) and new columns could be added in the future.
I'm not very technical with Excel, nor have I ever used VBA, so I apologize in advance if there is a simple/obvious solution that I'm missing.
Thanks in advance for your help.
Using your example, in the 'New' sheet cell D2 and copied down:
=IF(COUNTIF(Old!A:A,A2)=0,"YES",IF(SUMPRODUCT(COUNTIF(INDEX(Old!A:AG,MATCH(A2,Old!A:A,0),0),LEFT(A2:AG2,254)&"*"))=SUMPRODUCT(COUNTIF(A2:AG2,LEFT(A2:AG2,254)&"*")),"NO","YES"))
vlookup would also work well for this problem.
in D2, the formula would be:
=IF(AND(VLOOKUP(A2,Old!A:C,2,FALSE)=B2,VLOOKUP(A2,Old!A:C,3,FALSE)=C2),"NO","YES")
The column numbers (2 and 3) are the columns that correspond to the data you are trying to match, using the ID column.
It's possible to find the appropriate column using MATCH if the column names you have match the column names in the old sheet
This would make the formula look more complex, but Excel would adjust the Old!A:C reference if more columns are inserted.
The formula would look like this to match against column names
=IF(AND(VLOOKUP(A2,Old!A:C,MATCH($B$1,Old!$1:$1,0),FALSE)=B2,VLOOKUP(A2,Old!A:C,MATCH($C$1,Old!$1:$1,0),FALSE)=C2),"NO","YES")
The difference between this and the last one is the use of MATCH($B$1,Old!$1:$1,0) to find the column (using $s to anchor the lookup values)
In this case, specialized software for Excel compare is better.
My company use this software. Check it out.
http://www.suntrap-systems.com/ExcelDiff/
http://www.youtube.com/watch?v=QQgnWr_RT-8

Resources