Find and Compare Two Columns Excel (With Screenshots) - excel

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

Related

Find common rows from a given range of rows in excel

So I have to clean data where from a given range of rows maybe 2 or 3 are exact same, rest have at least one column different. I need a way to find it out as I don't want to do it manually. I've tried conditional formatting but that only works with columns.
In the image you can see rows 550:569 a few of them are exactly same. How do I highlight or find out that. I don't want to manually check each column
enter image description here
Insert a column (let's say column AG) where you put a formula like =TEXTJOIN(",",TRUE,A2:AF2)
Sort the range per the new column
Eliminate duplicate using Excel's Remove Duplicate tool.

EXCEL: Find instance among many by looking at adjacent column

I have a rather large excel sheet 20k+ rows. My excel document has three sheets named CM, PP, and CH.
CM only contains the Information I use.
PP is the public Information that contains ALL data.
CH is my change log.
What I'm trying to do is take the values from my CM sheet in Column A "CM(A)" and find them in the PP sheet Column A "PP(A)", then copy the found values from PP(A) and PP(F) "The sixth column over" to the third sheet CH(A) and CH(B).
This in of itself is rather simple, where I'm having a hard time is that sheet PP can contain multiple instances of the value in CM(A). The catch though is that I only need One of those specific values which is indicated by a value of "26" in column PP(B).
I just have no idea how to write the nested formula to make this happen.
Visual Goal of Formula
If you're unfamiliar with Array Formulas, you should definitely look into those as they are extremely helpful for tasks like this. You would need to use a conditional to test if the item occured more than once and then execute an INDEX-MATCH or VLOOKUP based on the results returned. I recreated your data structure and was able to achieve appropriate results using this formula in B1 of sheet CM:
=IF(COUNTIF(PP!A:A,A1)>1,INDEX(PP!F:F,MATCH(1,(PP!A:A=A1)*(PP!B:B=26),0)),VLOOKUP(A1,PP!A:F,6,FALSE))
Array formulas must be entered using Ctl+Shift+Enter, as is noted in the linked documentation.

comparing cells to a any cells in a given column

I have the following columns in Excel.
What I'm trying to do is to get data from two sets of column transferred to another set of column if their first column cell matches. So in the screenshot since boy has 100 in column I. it should transfer the 100 to Column C where Boy Row is.
I figured out a away to do it in Java using loops but I thought there might be an easier way of doing it directly in excel.
Although Vlookup is a formula that will work for your needs, it does come with some limitations. Better start using the best way from the start, which is nesting a Match formula in an Index one. With the example provided above:
=Index(I:I,Match(B:B,H:H,0))

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)

Combining Excel sheets/groups of columns by a condition in Excel 2007

Is there a way to combine 2 Excel sheets (or groups of columns inside one Excel sheet) so that the rows in one sheet/group append to the other sheet/group where so that certain columns values match.
To clarify:
Lets say I have 2 sheets - Sheet1 and Sheet2. Sheet1 has the columns A,B,C,D. Sheet2 has columns A,E,F,G. Column A in both sheets contains the same data but differently sorted (it is not sorted in conventional way (alphabetically or numerically)). I need to combine these 2 sheets into one, but they need to be combined so that the values in A column match (if possible the result should be ordered in the same way as the Sheet2).
Ideally, the functionality I'm looking for would need to be like SQL's INNER JOIN command.
I'm using Excel 2007.
Thanks
I think you basically described the VLOOKUP function.
You have your two sheets, now you want to create a list, which extends A,B,C,D to A,B,C,D,E,F,G.
For that, you could just use
Sheet1!E1=VLOOKUP(Sheet1!A1,Sheet2!A:G,5,FALSE)
Sheet1!F1=VLOOKUP(Sheet1!A1,Sheet2!A:G,6,FALSE)
Sheet1!G1=VLOOKUP(Sheet1!A1,Sheet2!A:G,7,FALSE)
If you need to create an extra sheet3 as a result, use this:
Sheet3!A1=Sheet1!A1
Sheet3!B1=VLOOKUP(Sheet3!A1,Sheet1!A:D,2,FALSE)
Sheet3!C1=VLOOKUP(Sheet3!A1,Sheet1!A:D,3,FALSE)
Sheet3!D1=VLOOKUP(Sheet3!A1,Sheet1!A:D,4,FALSE)
Sheet3!E1=VLOOKUP(Sheet3!A1,Sheet2!A:G,5,FALSE)
Sheet3!F1=VLOOKUP(Sheet3!A1,Sheet2!A:G,6,FALSE)
Sheet3!G1=VLOOKUP(Sheet3!A1,Sheet2!A:G,7,FALSE)
Hope this interpretation was correct.
Edit:
By the way, because Excel is not mainly intended to function as a database, this operation is a bit messy, because it does not dynamically scale. At least with the second approach, using a thrid sheet. You will have to copy down A1 at least that far, to match the last used row from Sheet1. And if you should copy it down further, so you won't have to worry about it for a while, you might need to error-proof against the empty cells.

Resources