Excel Update column based on another column from another sheet - excel

I've an excel with 2 sheets
In One sheet I've data like below
ID ID1 Name
1 101 ABC
2 202 XYZ
3 303 MNP
In Sheet2 I've data like below
ID ADD
1 LONDON
2 USA
3 CANADA
Now I need add one more column in sheet2 and want ID2 corresponding to ID1 from sheet1.
Like
ID ADD ID2
1 LONDON 101
2 USA 202
3 CANADA 303
Please help.

Use INDEX(MATCH()):
=INDEX(Sheet1!B:B,MATCH(A2,Sheet1!A:A,0))

Related

How to list row headers from matrix based on binary value (Excel)?

I would like to extract/list from a matrix the row headers based on binary values and depending on the column. Basically FROM something like this:
Country Product1 Product2 Product3
Germany 1 0 1
France 1 1 0
Spain 0 1 0
Italy 1 0 1
Belgium 0 1 0
OBTAIN something like this:
Product1 Product2 Product3
Germany France Germany
France Spain Italy
Italy Belgium
So basically list the values based on column and binary value.
Better if no VBA is involved.
Any suggestion is welcome!
Assuming your data is in a table named Table1, for Office 365:
=T(SORT(IF(Table1[Product1],Table1[[Country]:[Country]])))
and use the fill handle to drag right.

How update a dataframe column value from second dataframe where values on two specific columns that can repeat on first match on both dataframes?

I have two dataframes with different information about a person, on the first dataframe, person's name may repeat in different rows. I want to add/update the first dataframe with data from the second dataframe where the two columns containing person's data matches on both. Here an example on what I need to accomplish:
df1:
name surname
0 john doe
1 mary doe
2 peter someone
3 mary doe
4 john another
5 paul another
df2:
name surname account_id
0 peter someone 100
1 john doe 200
2 mary doe 300
3 john another 400
I need to accomplish this:
df1:
name surname account_id
0 john doe 200
1 mary doe 300
2 peter someone 100
3 mary doe 300
4 john another 400
5 paul another <empty>
Thanks!

In Excel how can a formula verify whether the column location or column element has taken the correct data from its header name?

The Input data
in sheet1
and
the output calculated in sheet2
Now the sheet1 data can be changed by the user for input, so now columns 'Units1' & 'Units2' may not be placed at the same address that are in columns 'C' and 'D' respectively, so suppose a new user will input the data in which 'Avocado' and 'Banana' are in columns C & D , then the 'Output' calculation in Sheet2 will be incorrect because we always want to use Units1 & Units2 for calculation.
How to fix this, so that every time the data is input the formula checks whether the correct columns have been taken for calculation or not?
Is there a way to use INDEX or family of LOOKUP functions or any other function for this.
Maybe by a creating a new sheet and making a table of Indexes which refer to (or point to) the column names of Data sheet
Location
Dates
Units1
Units2
Avocado
Banana
New York
05-01-18
10
12
1
2
Los Angeles
02-02-18
20
23
1
2
Chicago
08-03-18
30
34
1
2
Houston
05-04-18
40
45
1
2
Phoenix
02-05-18
50
56
1
2
Philadelphia
08-06-18
60
67
1
2
San Antonio
05-07-18
70
78
1
2
San Diego
02-08-18
80
89
1
2
Dallas
08-09-18
90
99
1
2
San Jose
05-10-18
100
112
1
2
Use INDEX/MATCH:
=INDEX(2:2,1,MATCH("Units2",$1:$1,0))/INDEX(2:2,1,MATCH("Units1",$1:$1,0))

excel match index if exists

I have 2 excel sheets:
Sheet1: (Value = Prevalue)
Id Preval Value
111 1 1
123 2 2
100 3 3
Sheet2:
Id Num Date
111 5
123 6 1/1/18
100 7
I want to perform a logic saying that: Matching the 2 sheets by Id, if Date on sheet2 exists then Value on sheet1 = num on sheet2 else = Prevalue
Id Value
111 1 (same)
123 6 (update since date exists)
100 3 (same)
How would this be done using index or vlookup? Many thanks!
Try this formula:
=IF(VLOOKUP(A2,Sheet2!$A$1:$C$4,3,0)="",B2,VLOOKUP(A2,Sheet2!$A$1:$C$4,2,0))

Excel Lookup for multiple values

I have two sheets in Excel. First one is city/branch name and the second is the branch's sales.
sheet 1:
City Branch
NY GoldenStar
NY Aquta
NY Orgi
Oregon Orgi
L.A Orgi
Oregon GoldenStar
....
Sheet 2 is detailed sales for each city
Branch
City GeldenStar Aquta Orgi
NY 45 456 90
L.A 155 345 34
Oregon 9 23 17
How can I use lookup function to assign each branch sale to sheet 1 ( I want to have a result like this :)
sheet 1:
City Branch Sale
NY GoldenStar 45
NY Aquta 456
NY Orgi 90
Oregon Orgi 17
L.A Orgi 34
Oregon GoldenStar 9
Use a combination of VLOOKUP and MATCH for this task. Consider this example:
Use the VLOOKUP to look into the data range (without headers) with the City name as the key. You get the column number from using MATCH with the Branch name into the header range.

Resources