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

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)

Related

How to compare two excel sheets list?

I have two sheets list both has the same data which is first name and last name. I want to know if list A has the same last name, and the first 3 character from first name from list B. I tried to use Vlookup function but I did not work. I want to match exact last name and exact three character from first name.
An example:
Worksheet 1
A B
1 John Smith
2 Jane Jones
3 Robert West
Worksheet 2
A B C
1 John Smith MATCH
2 Jane Jones MATCH
3 Bob West NO MATCH
In cell C1 on Worksheet 2 enter this formula as an array formula:
=IF(NOT(ISNA(MATCH(CONCATENATE(LEFT(A1,3),B1),CONCATENATE(LEFT(Sheet1!$A$1:$A$3,3),Sheet1!$B$1:$B$3),0))),"MATCH","NO MATCH")
Drag your formula down to include cells C2 and C3.
Notes
To enter as an array formula use CTRL + SHIFT + ENTER
Update the Left formula to match different numbers of characters in first name

Assigning a Unique ID to each Unique Name in Excel

I have a list of 20+ names in column A. There are some duplicates names in this list.
What I would like to do is assign a number to each of the unique name in the list. If a duplicate name occurs, the number should be duplicated as well.
Here's an example of what I am hoping to do:
Name ID
Alex 1
Allen 2
Bret 3
Dan 4
Dave 5
Dave 5
Harry 6
Joe 7
Joe 7
Tom 8
As you can see, a unique number is assigned to each of the name. Where a duplicate name appears, the original number gets duplicated as well, such as in the case of Dave and Joe.
If possible, I would like to avoid using VBA.
This list is dynamic and changes frequently, so I can't hardcode these numbers to each of the names, which is why I am hoping to get some assistance in developing a formula.
Try this in B2 and fill down.
=IFERROR(VLOOKUP(A2, A$1:B1, 2, FALSE), SUMPRODUCT(1/COUNTIF(A$2:A2, A$2:A2)))
Assuming this data starts with a header in A1:
In B2 put a 1 for your first unique id, then in B3 place the formula:
=IFERROR(VLOOKUP(A3, $A$2:$B2, 2, FALSE), B2+1)
And copy that down

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)

Want to search text from a group of words and then sum in excel

I have a data as below -
Name Amount
John Martha 20
John ABS 30
Man XYZ 10
Now, I want excel to search John from all rows and sum the value against it.
For example - John - 50
If you'd like to sum all values in column B where corresponding value in column A contains substring John, use this one:
=SUMIF(A1:A10,"*John*",B1:B10)
If you'd like to sum all values in column B where corresponding value in column A starts from John, use this one:
=SUMIF(A1:A10,"John *",B1:B10)
in both formulas range A1:A10 contains names and B1:B10 - amount

How to SUM parts of a column which have same text value in different column in the same row

I have a column with names and a column with numbers:
FirstName Name Number
John Smith 17
John Smith 26
Peter Smith 116
Peter Smith 25
Franck Black 17
Luke Peterson 17
Luke Peterson 37
Names with same FirstName and Name represent the same person. I need to sum the numbers associated with them. I prefer not to use VBA.
A PivotTable might suit, though I am not quite certain of the layout of your data:
The bold numbers (one of each pair of duplicates) need not be shown as the field does not have to be subtotalled eg:
This can be done by using SUMPRODUCT as well. Update the ranges as you see fit
=SUMPRODUCT(($A$2:$A$7=A2)*($B$2:$B$7=B2)*$C$2:$C$7)
A2:A7 = First name range
B2:B7 = Last Name Range
C2:C7 = Numbers Range
This will find all the names with the same first and last name and sum the numbers in your numbers column
If your data has the names grouped as shown then you can use this formula in D2 copied down to get a total against the last entry for each name
=IF((A2=A3)*(B2=B3),"",SUM(C$2:C2)-SUM(D$1:D1))
See screenshot

Resources