Combining Like Data in Excel - excel

So here is my situation: I need to take two spreadsheets in excel and combine the data together so that any additional data is paired up with common data between the cells. Here's an example of what I mean.
Sheet 1
1234567, JOHN, DOE, 1234567.JPG
Sheet 2
JOHN, DOE, 6634
First and Last names are common data, but the number in the second sheet does not exist in the first. The user list in both sheets are slightly different from each other so I can't simply alphabetize the names and move the additional column over. I have about 500 users to go through and may have to use what ever solution I come up with for similar lists of users.
Any assistance would be great.

There's various techniques you can use to combine data but you'll have to be a bit more specific. For example is there a fixed number of columns that sheet 1 doesn't have that sheet 2 does?
The basic technique would be to create some sort of unique identifier, perhaps by concatanating the names together in both sheets? that way you can use VLOOKUP to put all the missing data in one sheet into the other

Not sure I understood "I cant alphabetize the names". However, if the names have the same spelling i.e John is John in both sheets you can concatenate John and Doe in sheet 1 and do same in sheet 2 and use a vlookup function. Something like
A=cellcontainingJohn&CellcontainingDoe in sheet1
B=cellcontainingJohn&CellcontainingDoe in sheet2
C= Vlookup(A,rangeforB,columnnumber)

Here's what I would do:
Select the sheet into which you want to pull data from the other. I'll assume we're pulling data from sheet 2 into sheet 1.
In sheet 2, insert a column to the left of what you have already. JOHN is now in column B, DOE in column C, and 6634 in column D.
In sheet 2, column A, row 2 (assuming you have a row of column headers) which is currently empty, use the formula
=CONCATENATE(B2,C2)
Now, head back over to sheet 1. Let's assume you also have a row of column headers in sheet 1, so the cell immediately to the right of your 1234567.jpb is E2 and it's empty. In E2, use the following formula
=IFERROR(VLOOKUP(B2&C2,'Sheet 2'!$A:$D,4,FALSE),"")
That should give you what you're asking for, if I understand your question correctly.

Related

Matching up information on Excel from 2 different sheets

In the next step of the analysis I'm currently working on I have one sheet with two important columns. Column A specifies gene name and Column B specifies a number I am interested in (first screenshot). Then, I have a second sheet that repeats Column A but the gene name entries are in a different order to the first sheet and a Column B which has a lettered classification system (A-Z) which gives me some detail regarding the function of that gene. I would like to match the Column A and Column B data from sheet 1 to the Column B data from sheet 2 but as the column A in both sheets is the same but in a different order, is there a way to get Excel to match the correct letter in the second sheet to the correct gene name and number in the first sheet? The screenshots are of fake test data just to help me clarify this text! Any help really appreciated.
Use Index/Match() like below-
=INDEX(Sheet2!$B$2:$B$20,MATCH(A2,Sheet2!$A$2:$A$20,0))
VLOOKUP() will also work
=VLOOKUP(A2,Sheet2!$A$2:$B$20,2,FALSE)
If you have Excel365 then use XLOOKUP() function.
=XLOOKUP(A2,Sheet2!$A$2:$A$20,Sheet2!$B$2:$B$20,"Not Found")

Make rows sort together in excel without having value

I have an excel workbook with 2 sheets.
Column A of Sheet 1 and 2 are the exact same data. When I sort the first sheets data, Sheet 2 Column A is automatically sorted because it is referenced. (='Sheet1'!$A$2:$A$100).
But when I sort the above, Column B's cells in Sheet 2 don't follow the row of data. Now the data gets messed up because B2 in Sheet 2 did not move with the original A2 data that is referencing the first sheet.
Is there a way to keep the data together?
Below are images of sample data:
Sheet 1
Sheet 2
Now when I sort sheet 1 from Z-A:
Sheet 1 Sorted:
Sheet 2's sorted data (Not matching)
I want the phone number and contact name in sheet 2 to follow Alafia Village. Is there a way to make that happen?
For what it's worth, I don't agree that this is fundamentally bad design. If your two sheets were two tables in a database and you wanted to join them on 'something' so that the name was taken from the first table and the other details from the second table, that would be fine - much better than duplicating the names in the second table, which would be bad design. The only is issue is that the 'something' here is the row number and as soon as the order in sheet 1 changes, the row number doesn't work any more.
The answer would be to have a key in sheet 1 and look up the key in sheet 2. If this key were in column C (say) in both sheets, you would have an index/match in column A of sheet 2 like this:
=INDEX(Sheet1!A:A,MATCH(C2,Sheet1!C:C,0))
In practice, you might also want to look at Power Query.

amounts and ageing in excel

I have two excel files that I need to cross reference amounts in.
The first sheet looks like the below:
what I need to do is find any amount that are contained on sheet 2 and the month they fall into.
Sheet 2 looks like below:
for example on sheet 1 I have 56.49 in column C for reference AK1080117 in column A and this shows as Person 8 on sheet 2.
I can see this is correct as on sheet one it has a transaction date of 08-jan and on sheet 2 is in the column JAN.
There is no same ref that can be used between sheet 1 and 2 as sheet 1 has Reference and sheet 2 has Name.
Can anyone advise the best way to do this.
The complete sheets are hundreds of lines long.
Many thanks,
Note: Make sure your data has unique values AND it is not exceding the year 2017
If so, I have found a way to maybe do this in a few steps:
1: Add another column E to your first sheet and add this formula to second row of the column and drag it all the way down:
=SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")
2: Now create another column F next to the freshly made one and put this formula in second row:
=MATCH(C2;INDIRECT("Sheet2!"&E2&":"&E2);0)
3: Now create a third column G and put this formula in second row to be dragged down:
=INDEX(Sheet2!A1:D15;F2;1)
4: Now you have created a cross-reference because column G will show you the person with a match.
Edit: You can combine the three formulas direclty obviously but my personal preference is to brake things down to make them easier to understand :)
=INDEX(Sheet2!A1:D15;MATCH(C2;INDIRECT("Sheet2!"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MONTH(B2)+1,4),"1",""));0);1)
Good luck with it!
You need a third table that has Reference and Name. Then you can use lookup functions or table relationships to link the data together.
Ask the source of the first table to include Name as a field.

EXCEL - Match values from one sheet to another and then paste results

I'm trying to make the most user-friendly excel spreadsheet I can. This spreadsheet takes a name that the user puts in for a client, sometimes a first name and sometimes first and last. I have another sheet with the full list of clients, first and last names.
What I need to do is look at the user input, match that name to the client list sheet, and then paste that into the original sheet.
Example:
USER SHEET
A
1 Jane
2 Helen Smith
3 John
CLIENT LIST SHEET
A B
1 Johnson Jane
2 Smith Helen
3 Brown John
I need the User Sheet to look like
A B
1 Jane Johnson, Jane
2 Helen Smith Smith, Helen
3 John Brown, John
I know this might be a complicated formula, I've tried to write a whole bunch of different ones but none of them are really doing what I need them to.
Most of the problem is that I need other people I work with, who don't know how to use excel and sometimes aren't able to write the full names, to be able to use this spreadsheet once I have a generic formula in there, and all that would need to be changed is the Client List sheet.
Hopefully I provided enough detail in here. Thanks for any help you give me in advance, super appreciate it. If I find a solve I'll post it.
I have an idea. In your Client sheet, in the third column build a formula that combines first & last name, like:
=B1&" "&C1
Then select the range of names (columns A:C) and Insert Table (without headers). You can enter the header labels later:
From the Formulas Ribbon, open the Name Manager. Define a new name called "ClientNames" and have it refer to the fullname column (modify the Refers To formula based on your table's name & column header name):
Then, on your User Sheet, select column A, and from Data ribbon Data Validation. Allow "List" and set the "Source" formula to =ClientNames.
Finally, instruct your users to choose a client name from the validation list. This will prevent them from making bad inputs and also enforce a standard against the "Users" worksheet.
If you still need the formatted LastName,FirstName in column B, then do a formula:
=RIGHT(A1,LEN(A1)-FIND(" ",A1))&", "&LEFT(A1,FIND(" ",A1)-1)
This formula might be looking too complex but it is simple,
use this in column B of your user sheet and drag across the rows.
=IFERROR(INDEX(Sheet2!A:B,MATCH(LEFT(A1,LEN(A1)-FIND(" ",A1)),Sheet2!B:B,0),1)&", "&INDEX(Sheet2!A:B,MATCH(LEFT(A1,LEN(A1)-FIND(" ",A1)),Sheet2!B:B,0),2),IFERROR(INDEX(Sheet2!A:B,MATCH(LEFT(A1,LEN(A1)-FIND(" ",A1)),Sheet2!A:A,0),1)&", "&INDEX(Sheet2!A:B,MATCH(LEFT(A1,LEN(A1)-FIND(" ",A1)),Sheet2!A:A,0),2),IFERROR(INDEX(Sheet2!A:B,MATCH(A1,Sheet2!B:B,0),1)&", "&INDEX(Sheet2!A:B,MATCH(A1,Sheet2!B:B,0),2),IFERROR(INDEX(Sheet2!A:B,MATCH(A1,Sheet2!A:A,0),1)&", "&INDEX(Sheet2!A:B,MATCH(A1,Sheet2!A:A,0),2),""))))
This formula is for A1, you can modify it if you want to start from searching A2. Let me know if you need help. This might look big but its very useful for dragging across ranges.

MS Excel - Match 3 columns between two sheets. When matches are found, copy a 4th column from each to a third sheet

When the all three columns "Last Name, First Name and DOB" match on any rows between the 2 sheets, I need to have the account numbers from the matching rows listed on a third sheet. There are thousands of rows in each sheet. There will likely be multiple matches for some accounts. I prefer to put the functions on the 3rd sheet so that I can change out the lists in the first 2 sheets without needing to update them.
Sheet1
Acct # Last Name First Name DOB
89158 Stevens John 1/23/2012
Sheet2
Acct # Last Name First Name DOB
124578 Stevens John 1/23/2012
Sheet3
Sheet1 Acct # Sheet2 Acct#
89158 124578
Thank you in advance!
This works with duplicate values
The formula will need to be entered as an array (once copy and pasted while still in the formula bar hit CTRL+SHIFT+ENTER) and the range adjusted to fit your total values.
=IFERROR(INDEX(Sheet1!$A$2:$D$50,MATCH(1,($C2=Sheet1!$B$2:$B$50)*($D2=Sheet1!$C$2:$C$50)*($E2=Sheet1!$D$2:$D$50),0),1),"No match found")
The exact same formula can be used again changing Sheet1! to Sheet2!.
This will search for the last name that is in Sheet3!C2, first name that is in Sheet3!D2 and the DOB that is in Sheet3!E2.
I have only locked off the column in case you are looking to use this for a large volume of data and wish to drag it down.
If you want to display the additional account numbers that meet the search criteria and are only using sheet 3 to search for one person, then you will need to look at using INDEX(), MATCH() and SMALL().
I had looked to include this alternative in my answer too but I am now leaving the office. It won't take me long to conjure if you struggle so drop me a comment and I will be happy to explain how it all works.
EDIT: To list all ID's found for the search criteria - Leave blanks where not found
=IFERROR(INDEX(Sheet1!$A$2:$D$50,SMALL(IF(COUNTIF($C$2,Sheet1!$B$2:$B$50)*COUNTIF($D$2,Sheet1!$C$2:$C$50)*COUNTIF($E$2,Sheet1!$D$2:$D$50),ROW(Sheet1!$A$2:$D$50)-MIN(ROW(Sheet1!$A$2:$D$50))+1),ROW(Sheet1!1:1)),1),"")
Again, replace sheet 1 for sheet 2 and update the ranges to match what you are searching through, use CTRL+SHIFT+ENTER in the formula bar to make the formula an array then you can drag it down to cover all the potential matches, best to aim for what you believe would be the highest number of duplicate IDs.
Let me know how you get on, if this answers your question, please mark this as an answer using the tick to the left, thank you.
I ended up putting list A and List B into a sheet and then using this formula: =ISNA(MATCH(B2&C2&D2,I:I&J:J&K:K,0)) Then I created another sheet where I added list B and then list A and used the same formula. Once the calculation was complete for each sheet, I used filters to only list the matches for the first lists in each spreadsheet.
I then took the matches for each sheet and listed them side by side in the third sheet. I made sure the sort was matched between the two lists and then was able to scroll through a page at a time and identify a few users with multiple account numbers in each system.
It's not as automated as I would like, but it is done for now. Thank you Stack Overflow!

Resources