Excel Function - If string from column A is found in Column B Then - excel

Column A has a list (first and last names) of all users who have an O365 license. Column B has a list of everyone in the company. Column C is associated with Column B and has the job title of everyone in the company.
I want each row in A to check all of B to see if they match. If they match I want to take the corresponding row in column C and copy/paste it into the same row in blank column D
A (O365 License
B (All Employees
C (Job Title).
D (JobTitle)
John Smith
Jarvis Cobblepott
. IT Guy
Nancy Johnson
John Smith
. Receptionist.
Kevin Gordon
Henry Kissinger
Marketing

Use ISNUMBER(MATCH()) to see if it exists:
=IF(ISNUMBER(MATCH(B2,A:A,0)),C2,"")

Alternatively maybe:
=XLOOKUP(A2,B$2:B$4,C$2:C$4,"",0)
Or:
=BYROW(A2:A4;LAMBDA(r,X.XLOOKUP(r,B2:B4,C2:C4,"",0)))

Related

Excel - Append cell2 to cell1 if cell3 is not blank

All,
I've taken a browse around and I've been unable to nail down the formula I'm looking for. I'm a bit new to Excel expressions, so this is all part of the learning process.
My quandary:
I have a list of names in an Excel spreadsheet - some have two components and some have three. I need all names to have only two components - if they have three, then the first two components need to be combined.
Here is my workflow:
IF cell 3 is occupied, append the content of cell 2 to the end of cell 1 IN cell 1. Then, assuming cell 2 is now blank, move the content of cell 3 to cell 2. Else, do nothing.
So my input might be (assuming each group of characters is in its own cell):
JOHN SMITH
JOHN DOE SMITH
BARRY JOHNSON
RICHARD P RICKSON
JACK JACK GILES
My output would be:
JOHN SMITH
JOHNDOE SMITH
BARRY JOHNSON
RICHARDP RICKSON
JACKJACK GILES
What's your take on this?
Assuming your data is in columns A, B, and C, this will put the correct output in columns D and E.
In column D:
=IF(ISBLANK(C1),A1,CONCAT(A1,B1))
In column E:
=IF(ISBLANK(C1),B1,C1)

Excel - Match data from column and get the value next to it

Is there a formula that match data, get the value next to it, and then post that value into another cell?
This is what my excel sheet looks like:
Sheet A
Column A | Column B | Column C | Column D
----------------------------------------------------------
Bob John Cat
John Sue Dog
Sue Bob Duck
John owns a cat, Sue owns a dog, and Bob owns a duck. I want to match Column A to Column C and then grab the value right next to Column C and then put that value back into Column B.
This is the result that I want:
Sheet A
Column A | Column B | Column C | Column D
----------------------------------------------------------
Bob Duck John Cat
John Cat Sue Dog
Sue Dog Bob Duck
Thanks in advance!
Here's a solution using the VLOOKUP() function. Enter the formula in cell B1 and pull it down. You might need to edit your range aswell.
=VLOOKUP(A1;$C$1:$D$10;2;0)
*you might need to change ; with , depending on your language settings.
You could use vlookup (as you've tagged your question) but combining index and match is a much more versatile way of doing this (it doesn't require the the lookup row to be on the left side and is also more efficient).
Assuming row 1 contains headers, you could use the following formula in column B:
=index($D$2:$D$4,match(A2,$C$2:$C$4,0))

Match Value in Cell to an Existing Column and Return Adjacent Cell Text

I have a spreadsheet containing patients in column a, patient's diagnosis in column b, and their doctor in column c. I have another sheet that has the doctors listed in column a and their practice group in column b. I need a function that will look at each value in column c on sheet 1, match it to the doctor in column a on sheet 2 (Doctors List), and return the practice group to column d on sheet 1. I have tried a few formulas including this one
=IFERROR(VLOOKUP(C2,'Doctors List'!A:B,2,FALSE),"")
but can't seem to get anything to work! It just returns blanks. Please help!
**SHEET 1
Patient Name Diagnosis Attending Physician Practice Group**
Patient A Diagnosis Dr. Smith
Patient B Diagnosis Dr. John
Patient C Diagnosis Dr. Joe
Patient D Diagnosis Dr. Ken
Patient E Diagnosis Dr. Williams
Patient F Diagnosis Dr. Williams
Patient G Diagnosis Dr. Smith
Patient H Diagnosis Dr. Jones
**SHEET 2
Physician Practice Group**
Dr. Smith Practice A
Dr. John Medical Group A
Dr. Joe Practice B
Dr. Ken Medical Group B
Dr. Williams Practice C
Dr. Jones Medical Group C
Try using MATCH and INDEX rather than VLOOKUP
So in D2 of sheet 1:
=INDEX(Sheet2!$B:$B,MATCH($C2,Sheet2!$A:$A,0))
and copy that formula down.
If you're looking to troubleshoot, your existing formula, try using "Evaluate" on the Formulas tab of Excel 2010 which can step you through the calculation.
I've had problems with text fields that have extra spaces after them, so I regularly use the "TRIM" function when doing lookups, or matches.

Excel macro/formula - replace cell values if value does NOT appear in another column

I need help. I have a list of 20 names of certain consultants. I receive a new sheet daily with many names, and if one of them does not match with any of the 20 consultant names, I need to replace the cell value with "X".
E.g.
1. Consultant's list contains John and Mary.
2. Daily list contains 5 names: John, Steve, Dean, Mary and Sue.
3. I now want to replace all the cell which does NOT contain John and Mary with X (thus replace cell with names Steve, Dean and Sue with X)
Help will be appreciated
If your 20-name list is in ColumnA and the daily list in ColumnB each starting in Row1 then in Row 1 and copied down to suit:
=IF(ISERROR(MATCH(B1,A:A,0)),"X",B1)

Excel Macro - Find a specified value in one column and replace with all the contents of another column(the length is flexible)

I have a spreadsheet with more than 3000 rows, and I want to replace specific values(v1,v2,...) in column A with the content in column B and C and ...
The length of content in column B,C,... is not fixed so it is not possible to use REPLACE function provided in Excel.
It is also impossible to edit for each row, as the content is very long.
simple example:
column A
{who} is the coach of {team}
{who} is the coach of {team}
{who} is the coach of {team}
column B
Alex Ferguson
Roberto Mancini
Rafael Benitez
column C
Man United
Man City
Chelsea
column D
Alex Ferguson is the coach of Man United
Roberto Mancini is the coach of Man City
Rafael Benitez is the coach of Chelsea
Column D is what I want(column B to replace {who}, column c to replace {team}).
Try this in column D:
=SUBSTITUTE(SUBSTITUTE(A1,"{who}",B1),"{team}",C1)
You can also do it without the "{who}" thing in column A:
=B1 & " is the coach of " & C1

Resources