How to search for matching data and return result from a cell?

Arinoum

Board Regular
Joined
Sep 28, 2016
Messages
64
Hello, I'm not sure which formula to use to return the value from a Cell. I have 2 documents with all the same information except that one sheet does not have column for Login ID. I would like to add column Login ID but match it to match the same information on the rows. It needs to match the User number. I basically want it to search if A1 from first sheet = B1:B3000 from second sheet then return the value matching that from c1:C3000. I thought of a simple IF(A1=B1,C1,0) but this isn't working because the numbers change in column C and I need it to look in all of column C and A instead of just one cell match. Thank you!

User numberUser nameLogin ID
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
this isn't working because the numbers change in column C and I need it to look in all of column C and A instead of just one cell match
Need more clarity on how numbers change in Column C?

Further to give you an optimal solution would need few things as below -

# Update your current Excel Version and platform

# Share an XL2BB of actual data to understand the complexity of the situation

You can find links to both, below 👇 in my signatures.
 
Upvote 0
Try these:

Assuming you want to put the new looked up value in cell Sheet1!B1

Excel Formula:
=XLOOKUP(A1,Sheet2!B1:B3000,Sheet2!C1:C3000)

if you don't have 365 (Update your profile so the forum knows your version please)
Excel Formula:
=VLOOKUP(A1,Sheet2!B1:C3000,2,0)
 
Upvote 0
Need more clarity on how numbers change in Column C?

Further to give you an optimal solution would need few things as below -

# Update your current Excel Version and platform

# Share an XL2BB of actual data to understand the complexity of the situation

You can find links to both, below 👇 in my signatures.
My apologies, I'm finding it hard to explain. Below is the sheet. I am adding column A and I want the information from Column A of sheet 2 to populate in column A of sheet 1.

Cost Code (this exists in sheet one and I would like it to populate here so the formula would go here)User Name
=if(user name column rage sheet 1 = user name column range sheet 2, return value from sheet 2 column A)
 
Upvote 0
You cant have a value in column A and then want to put a formula in column A.
What column contains "user name" on sheet 1?
If it is not column A, then the formulas in Post #2 will work you just need to change the references.
And, what is also important, you have not said what version of excel you are using?

Cells in Sheet1 Column A, beginning with A2

=XLOOKUP("sheet 1 user name column row 2", "sheet 2 user name column", "sheet 2 logon ID column")
 
Upvote 1
You cant have a value in column A and then want to put a formula in column A.
What column contains "user name" on sheet 1?
If it is not column A, then the formulas in Post #2 will work you just need to change the references.
And, what is also important, you have not said what version of excel you are using?

Cells in Sheet1 Column A, beginning with A2

=XLOOKUP("sheet 1 user name column row 2", "sheet 2 user name column", "sheet 2 logon ID column")
Thank you so much!
 
Upvote 0
You're welcome.

Best wishes!
One more question if you don't mind. I'm trying to do the same but there are 3 criteria. Name, Machine ID and Hosted ID which are unique numbers that do not repeat. The names repeat if the name is associated with multiple Machine IDs and Hosts. I used the same formula you gave me and the result is matching the name to the first machine ID number and it repeats that number each time the same name appears. My sheets has the same name but different IDs. Not sure how to do this. Can I do something like =match name from sheet 1 to name from sheet 2 and return result of Machine ID and repeat it however many times the machine ID differs and appears. I should add that both ID numbers are unique meaning if Machine ID is W22 and Hosted ID is Q11 that's the only time those 2 numbers appear and they are only associated with one another.
NameMachine IDHosted ID
 
Upvote 0
Sure. Sheet1 has a column with names. I'm trying to add to it information from sheet 2 that has a column for names, Machine ID and Hosted ID. I wanted to do a simple IF names match then return value in B and C2 however Sheet 1 has other details and the names repeat more than in sheet 2 due to the information listed in other columns. I would like to keep the other column information the same I am just looking to add 2 more columns with Machine and Hosted ID matching the names. Thank you so much for your help!




NamesMachine IDHosted ID
Green, JohnW11Q1
Green, JohnW33Q5
Green, JohnG54R4
Green, JohnH55Q3
Marks, HeatherW88S01
Marks, HeatherW90Q22
Andrews, JoeE34W12
Andrews, JoeF19R04
Andrews, JoeW10R6
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top