I have an excel sheet with a series of last and first names in columns B and C. I'm trying to match names to those in a second sheet in columns A and B. Not every name will match and first or last names might be duplicate but assume never both. I've tried this
=IF((MATCH(B3,Sheet1!$A$1:$A$150,0)*MATCH(C3,Sheet1!B1,0))>1,1,0)
It kind of work but there is nothing stopping excel from matching the last name and then going to a separate line entry to find the first name.
Can somebody please show me how to make excel only search the same row for the last name as it found the first?
I'm not sure if I'm clear about the thing you try to do, but I've two suggestions:
Is this the way you want it to work?
=IF((MATCH(B3,Sheet1!A:A,0))*AND(MATCH(C3,Sheet1!B:B,0))>1,1,0)
What if you make third column in each sheet, using:
=CONCATENATE("CELL WITH A FIRST NAME", " ", "CELL WITH A LAST NAME")
stretched down to the whole data. Then you can do your match between this 2 columns.
With first names in column A, last names in column B on sheet 1, and first name in B3, last name in C3 on current sheet:
=match(B3&C3,index(Sheet1!$A$1:$A$150&Sheet1!$B$1:$B$150,0),0)
Formula in D3 returns the position of the found match:
Don't use with whole column references. It will be slow to recalculate.
Related
I have an Index/match and it isn't returning all names correctly. The error seems to be if there is a duplicate last name but I don't know how to correct it. Here is my formula:
=IFERROR(INDEX('[Data File]Sheet1'!$E:$E, MATCH(A2, '[Data File]Sheet1'!$B:$B & "," & '[Data File]Sheet1'!$C:$C, 0)), "")
The idea is to return a blank unless what is input in column A matches the data from Data File Sheet1. Data File Sheet1 Column B is Last names and Column C is first names. I have no control over this file.
My file logs names as first, last in column A. When sucessful this should return the matching line E from Data File Sheet1.
Like I said, this seems to work if the last name is unique but breaks if there is a duplicate.
The first image is what the data is input like in my program.
The second is what the data looks like in the sheet I pull data from.
In these images only Fake Name would work with my code, Should Work and Might Work will both return my error line, i.e. a blank.
Create a Key column for your name match to avoid this. You can use a concat of the first and last name to get better matches.
Enter this into your new column =(Firstnamecell&" "Lastnamecell)
Use this key column in your formula Match(A2, referenceyourKeyColumn, 0))
I am trying to populate B2:D5 with "yes"/"No" ( Figure 1) based on the criteria that if I find the respective pvalue( Column A) , in the 'Test' column in a separate sheet and the Fvalue matches the column header of figure 1. I tried using the formula visible in figure 3. However, it incorrectly labels the cow and chicken columns. Which I suspect is due to it stopping at the first " True" value it finds, and not iterating over the other values once it finds said true value.
Use COUNTIFS()
In B2:
=IF(COUNTIFS(Sheet1!A:A,$A2,Shee1!B:B,B$1),"Yes","No")
Then copy over and down the grid.
Where Sheet1 is the list.
I have two sheets within a workbook, the first with several thousand lines of expenses, separated by individuals, and the second a summary of totals and such.
On the second sheet, I've created a reference to the first to insert each individual's name (i.e. B4: ='Card Transactions'!D89). I'm having difficulty with the syntax for returning the total of each individual's total, which is in a predictable cell in the first sheet relative to the name (down 1, right 7).
I've tried the following:
=offset(indirect(B4),1,7) with only a reference error in return. This seems like it should be relatively simple but I'm not having any luck. . . any suggestions?
use this:
=OFFSET(INDIRECT(MID(FORMULATEXT(B4),2,300)),1,7)
note:
this only works if the formula in B4 only contains the one cell reference.
This is a volatile function and will cause a noticeable lag in calculations if used too many times.
The following should work for you as long as your data follows these rules:
Your columns have headers
The names are all in the same column
And you are able to set the range with row numbers and not just full columns
Let's say your first sheet is set out like this:
And you want your second sheet like this:
And your sheets are named:
Sheet1
Sheet2
This is the formula in B2 of Sheet2:
=INDEX(Sheet1!$A$1:$H$9,MATCH(A1,Sheet1!$A$1:$A$9,0)+1,MATCH("Column 8",Sheet1!$A$1:$H$1,0))
And here's what it does:
Your index array is the entire blue area, this can be the whole sheet but can't be a full column reference, the row number must be specified. In this example, the index array is $A$1:$H$9 and the $ signs mean the range won't move when you drag down the formula, so they are important!
Your first match finds the row number, it uses the name (in this case 'bart') as the lookup value, and the purple area as the array. In this example the row array is $A$1:$A$9 and the row numbers must match the row numbers in the index array. The match has a "+1" at the end, so it will find the matching row, then add one row down to get your offset.
Your second match finds the column number, it will need to use the name of your column. In this example the column array is $A$1:$H$1 and the column letters must match the column letters in the index array.
Let me know if this doesn't fit your problem, I'm sure we can figure it out.
Thanks.
I have two excel sheets that I am working with. Sheet 1 has a 'last name' column D and sheet 2 has a 'name' column A. the 'name' column contains last,first name so I need a partial match option to find the customers last name in each sheet and create a new list using the information found in the 'name' column A from sheet 2 in another sheet. This may be simple but for someone who lacks in excel I would appreciate the help.
You could perform an INDEX MATCH function with wildcard search.
=INDEX(B:B,
MATCH("*"&D2&"*",Sheet2!A:A,0),1)
The match function will search for the partial string in cell D2. (Which would be a last name assuming D1 is the title of the column) - The "*"& part on either side of D2 searches for the partial string. If the column only contained last names, it would just be
=INDEX(B:B,
MATCH(D2,Sheet2!A:A,0),1)
After it searches for the partial string, it will search through column A in Sheet2 and find the name which matches (Lets hope you do not have duplicate names).
Once you have matched two names, in comes the INDEX function. This will obtain the corresponding value from any column you want but only in the same row as that last name.
If you want it all in another sheet, you could do.
=INDEX(Sheet1!B:B,
MATCH(Sheet1!"*"&D2&"*",Sheet2!A:A,0),1)
Maybe chuck in some error handling as well.
=IFNA(INDEX(Sheet1!B:B,
MATCH(Sheet1!"*"&D2&"*",Sheet2!A:A,0),1), "No Match or No Data")
I have a large excel file, it has 65,000 parts, those part numbers are in column A. Then it has several columns of important info next to the part number (B is retail price, C is my cost, D is the weight, E description and so on until J)
I was just given a list of 16,000 new parts, they are superceeded from old parts, all the new list tells is new part number in column A and old in column B.
So what I can't figure out is how to tell excel if B65001 matches anything in column A1-A65000 then copy the information from the columns next to that A cell into the columns next to this duplicate.
I hope that makes sense?
Please help
I would:
Put the list of new parts in a new sheet (let's call this "Sheet2")
Sort this by column A (required for the VLOOKUP function)
Insert a column next to A in the original sheet
Put the formula =ISERROR(VLOOKUP($A2, Sheet2!$A:$B, 2, FALSE), $A2, VLOOKUP($A2, Sheet2!$A:$B, 2, FALSE)) in column B2 of the original sheet (the new column, and I'm assuming you have headers), and fill it down
Copy this new column and paste it over itself, but select Paste Values from the Ctrl paste options menu. This will get rid of the formula and solidify the new part number as text.
Delete the old A column and the new B column will take its place.
Delete Sheet2 if desired.
The formula in layman's terms: Excel will search for the old part number in Sheet2. If not found, it will produce an error, and just use the old number. If found, it will use the value next to the old part number on Sheet2, the new part number.
An explanation of the VLOOKUP function:
The first argument is the value to search for. In this case the value in the A column of the same row (fill-down will automatically change the "2" accordingly)
The second argument is the range to search in. Excel will look in the first column of this range for the value, and it MUST be sorted.
The third argument is the 1-based index of the column to return. In this case, you want the second column.
The final argument determines whether to return the nearest match (TRUE) or only exact matches (FALSE). You want the latter behavior.
VLOOKUP in this mode will produce an error when a match is not found (specifically #VALUE when the value would come before the first instance of the table, or #N/A if the value is not found in exact-match mode)
Copy the Column in other sheet into you want to search Duplicates,, & write this simple formula but break the database in parts to avoid system delay,,
=IF(COUNTIF($A$2:$A$8, $A2)>1, "Duplicate", "")
Use this array formula to count Duplicates,
=ROWS($A$2:$A$8)-SUM(IF( COUNTIF($A$2:$A$8,$A$2:$A$8)=1,1,0))