Merge data from two sheets into correct row - excel

I have two excel sheets, with data similar to this:
SHEET 1:
A B C
1 Josh 30 Austin
2 Sam 28 SF
3 Mary 35 Chicago
SHEET 2:
A B
1 Josh Car
2 Mary Truck
3 Sam Van
What I'm attempting to do is merge the two based on Column A. For example, the outcome would be:
A B C D
1 Josh 30 Austin Car
2 Sam 28 SF Van
3 Mary 35 Chicago Truck
I've tried digging through the Excel support on Microsoft's site, but I'm not getting anywhere. Originally I thought it would have something to do with the Data > Consolidate feature, but that doesn't seem to be working.

With the assumption that your names are unique in Sheet2,
On Sheet1 Cell D1 enter:
=Vlookup(a1,Sheet2!a:b,2,0)
And drag it until the end of your data.

Related

Merging Excel sheets by categories

I want to attach categories from a different dataset to another dataset using Excel if that makes any sense. For example, I am given a dataset:
Column A
Column B
0
Happy
1
Sad
2
Angry
And dataset:
Column A
Column B
Column C
John
0
today
Bob
1
tomorrow
Ron
2
yesterday
Sally
1
yesterday
Amy
2
today
Lin
0
yesterday
I want the data to end up looking like this:
Column A
Column B
Column C
Column D
John
0
today
Happy
Bob
1
tomorrow
Sad
Ron
2
yesterday
Angry
Sally
1
yesterday
Sad
Amy
2
today
Angry
Lin
0
yesterday
Happy
I was told to use a VLookUp formula to make it happen, but every single time that I try, I get NA values, and I have no idea how to approach the problem. I am also somewhat new to Excel.
=VLOOKUP(B2, sheet1!$A$1:$B$4, 2, FALSE) drop it in D2 and drag down. Without $ it moves range you are looking at when dragging
Or you can lookup for whole array:
=VLOOKUP(B2:B7, sheet1!$A$1:$B$4, 2, FALSE)

Get multiple values in a single cell with array formula

I'm trying to get an array formula to get the multiple results in a single cell. Is that possible?
For example below, I'd like to show in D2 all the names in column B corresponding to rows for values less than 4 in column A.
My current attempt below:
A C
2 Jane
3 John
6 Thomas
1 Michael
2 Mary
7 Jason
3 Gloria
1 Andrea
=CONCAT(INDEX($B$2:$B$9,IF($A$2:$A$9<4,$B$2:$B$9)))
My desired result would be:
Jane, Michael, Mary, Andrea
You need FILTER() then TEXTJOIN().
=TEXTJOIN(", ",TRUE,FILTER(B2:B9,A2:A9<4))

How to unpivot a data using excel formula

I have a table as below,
Column A
Column B
Tom
12,45
Kenny
1,4,6
Jude
1,4,5,7
Benji
15,48
Need it like as below
Column A
Column B
Tom
12
Tom
45
Kenny
1
Kenny
4
Kenny
6
Jude
1
Jude
4
Jude
5
Jude
7
I have tried using the FILTER function, however it is not providing what I need.
Office 365. assuming a range of A1:B4 (change as required within the formula):
=LET(ζ,A1:B4,κ,INDEX(ζ,,1),λ,INDEX(ζ,,2),α,"<a><b>",β,"</b><b>",γ,"</b></a>",δ,"//b",ξ,FILTERXML(α&TEXTJOIN(β,,SUBSTITUTE(λ,",",β))&γ,δ),IF(SEQUENCE(,2,0),ξ,INDEX(FILTERXML(α&CONCAT(REPT(κ&β,1+LEN(λ)-LEN(SUBSTITUTE(λ,",",""))))&γ,δ),SEQUENCE(COUNT(ξ)))))
It is assumed that there are no names in column A with a corresponding blank in column B.

How to extract unique values from one column based on criteria from two other columns, with or statement?

My data set looks something like this:
ID Name1 Name2
1 Jack Tom
1 Tom Tom
1 Lisa Tom
2 Tom
2 Tom
3 Frank Frank
3 John Frank
3 Frank Frank
3 John Frank
4 Tom
4 Tom
5 Lisa
5 Jack
and I want the following output:
Result
1
2
4
Note: I want the unique IDs for Tom if "Tom" shows in one of the two name columns.
I tried to use the following formula:
IFERROR(INDEX(INDIRECT($B$14); MATCH(0; IF($B$10=INDIRECT($B$16); IF($B$10=INDIRECT($B$15); COUNTIF($E$27:E27; INDIRECT($B$14)); "")); 0));"")
The problem is that this only gives me ID nr 1 as output since Tom shows up in both columns in this case. I think I need to implement an OR-statement to the formula.
Explanation of my formula:
Indirect(B14): array for the call IDs. B14 contains a name of this array.
B10: Contains the name I want to match (i.e. "Tom")
Indirect(B16): column Name1
Indirect(B15): column Name2
Good answers will be rewarded:)
I used your formula (without INDIRECT statements) and added ISNUMBER & FIND in order to find "Tom" in a combination of columns B and C:
This is an array formula (Ctrl+Shift+Enter):
=IFERROR(INDEX($A$1:$A$14,MATCH(0,COUNTIF($F$1:F1,IF(ISNUMBER(FIND("Tom",$B$1:$B$14&$C$1:$C$14)),$A$1:$A$14,"")),0)),"")
Result:
I couldn't use INDIRECT references as I'm not sure what exactly they point to (i.e. what are the ranges & column names). I hope it won't be too difficult for you to modify my formula in order to match your references.
Hope it helps! Cheers.

Excel Help - How to delete duplicates from multipe columns

I am trying to configure a spreadsheet for payroll. In column A I have the employee name. In column B I have the amount of hours they worked. I currently have the sheet broken down by job title/ dept that a particular employee works. In column G I have my skilled employees names and have a formula to auto-populate their hours from column B if their names are found in column A (=VLOOKUP(G2,A:B,2,FALSE). I also have a formula in Column D and E that will take anyone with hours greater than 0 from A and B and paste them (=IF(B2>0,B2," ")). I am now looking for a formula that will delete employee name and hours from D and E if they are in columns G and H. An example of the spreadsheet is:
A B C D E F G H
1 Doe, John 8 Doe, John 8 Doe, John 8
2 Doe, Jane 8 Doe, Jane 8 Bee, Max 8
3 Roy, Bill 8 Roy, Bill 8
4 Bee, Max 8 Bee, Max 8
Assuming the formula for populating column D is =IF(B2>0,A2," ") one way to accomplish what you want is to amend that formula to read =IF(AND(B2>0,COUNTIFS(G:G,A2)<1),A2," "). Similarly amend the formula in column E to read =IF(AND(D2<>" ",B2>0),B2," ").
Hope this helps.

Resources