lookup value in Excel - excel

I have 2 table.
Table 1
ID Name
1 AAA
2 BBB
3 CCC
Table 2
ID Name
1 AAC
2 BBB
4 DDD
As output, I would like to to find out -
when the ID matches between 2 tables do we have the same Name there, if so the Output should be Name Match or Name mismatch. Else if the ID is not found between those 2 tables, the output should be "ID Not found"
Expected result -
ID Name Result
1 AAA Name mismatch
2 BBB Name match
3 CCC ID Not found
Anyone knows which query I should use in Excel to get the expected result!

use:
=IF(ISNUMBER(MATCH(A2,E:E,0)),IF(COUNTIFS(E:E,A2,F:F,B2),"Name Match","Name Mismatch"),"ID Not Found")
Or this shorter formula:
=IFERROR(IF(VLOOKUP(A2,E:F,2,FALSE)=B2,"Name Match","Name Mismatch"),"ID Not Found")

Related

Multiple Unique Lists from Master List in Excel

I have a list of companies with multiple contacts for each company, but I would like to create separate lists with 1 unique contact per company. E.g.
Original list
Name Company Email
John AAA john#aaa.com
David AAA david#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
Craigh CCC craig#ccc.com
John CCC john#ccc.com
In this case, to have 1 unique record from each company in a separate list, I want to end up with 3 separate lists:
List 1
Name Company Email
John AAA john#aaa.com
Jane BBB jane#bbb.com
Julia CCC julia#ccc.com
List 2
Name Company Email
David AAA david#aaa.com
Craigh CCC craig#ccc.com
List 3
Name Company Email
John CCC john#ccc.com
As you can see in each list there is only 1 record for each company.
Any help on how to do this would be most appreciated.
I have tried advance filter to list unique records only by selecting the entire original list as the range and setting the company column as the criteria see the unique records which I could then select visible cells and cut to a different list, and then re-run the filter again to create the next set of unique records etc...but the advance filter doesn't give the results as expected.
-
-
This might be a silly idea but still worth trying... Add a helper column with Count formula:
=COUNTIF($B$1:B2,B2)
Apply Filter and Sort your data set by the fourth column (Sort Smallest to Largest):
This seems to match your Table 1, 2 & 3 output.
Alternatively, if you still want to create separate tables, you can use the helper column and array formulas (Ctrl+Shift+Enter) as per example below:
=IFERROR(INDEX($A$1:$C$7,SMALL(IF($D$1:$D$7=1,ROW($D$1:$D$7)),ROW()-1),COLUMN()-5),"")
Change $D$1:$D$7=1 to =2 and =3 to replicate the 2nd and the 3rd table.
Edit: with additional "Location" column
=COUNTIFS($B$1:B2,B2,$D$1:D2,D2)

Can you normalize data with embedded sections in excel?

I was provided with some data in excel that I'm trying to transform to make it filterable. The data is in a specific order and looks like this:
Group ID RowType Name
1 Section Name1
1 Row AAA
1 Row BBB
1 Row CCC
1 Section Name2
1 Row DDD
1 Row EEE
2 Section ...
I want to take the name of the Row Type "Section" and transform it into a constant in it's own column. The final product would look like:
Group ID Section RowType Name
1 Name1 Row AAA
1 Name1 Row BBB
1 Name1 Row CCC
1 Name2 Row DDD
1 Name2 Row EEE
2 ...
I feel like this has probably be done but I haven't been able to put together the right terms to search... Any help would be appreciated.

Getting a modified range of cells

I need to apply a function to a range of cells and then getting the modified version of this range.
I need to apply LEFT(A1;FIND(" ";A1&" ")-1) to a range (A1:A6) and get the range back so that =SUMIFS(B1:B6;A1:A6;"AAA") works.
Actual problem:
A company sells drugs and they want to know the total sales of a specific drug sold.
A | B
1 AAA tbl 20x50g | 3
2 AAA tbl 90x50g | 4
3 BBB 10% raz 1ml | 1
4 BBB 2% raz 1 ml | 8
5 BBB tbl 12x2,5 | 1
6 CCC vet 48x1kg | 7
On the next list is a list with only the "generic" name:
C | D
1 AAA | ?
2 BBB | ?
3 CCC | ?
I need to get the values in D1.
So far I have came to:
=SUMIFS(B1:B6;A1:A6;LEFT(A1;FIND(" ";A1&" ")-1))
This will compare everything in A1:A6 with the first company (AAA). If it gets a match (A1, A2) it will take the value from the B1:B6 and the answer would be 7.
But I need to apply the "get first word" function
LEFT(A1;FIND(" ";A1&" ")-1)
to the range A1:A6
EDIT:
My bad. It appears I was trying to reinvent fire by spiting water on wood.
The problem was elsewhere.
The values in B were being produces through
=IF(AB34=0;" ";AB34*$Y34)
and the TRUE clause (" ") messed up the math.
You would use the SUMPRODUCT with LEFT(FIND()):
=SUMPRODUCT((LEFT($A$1:$A$6;FIND(" ";$A$1:$A$6 & " ")-1)=D1)*$B$1:$B$6)

Excel file - Keep the most recent for each ID

I have an excel file with this kind of data:
ID1 XXX YYY 22/11/1987
ID1 ZZZ AAA 23/11/1987
ID2 ZZZ AAA 23/11/1987
In that case, I would like to keep, for each ID (other fields might be differents), the most recent one, which would lead me with:
ID1 ZZZ AAA 23/11/1987
ID2 ZZZ AAA 23/11/1987
Thank you for your help
Assuming your data is in four columns (A:D) you might apply an array formula (CSE entry) such as:
=MAX(IF(A:A=A1,D:D))=D1
(although it would be preferable to restrict the number of rows to something manageable) in Row 1 and copied down to suit, to identify (by FALSE) rows to be deleted with Filter.

Excel - identify duplicates consisting of two columns, in changing order

I am trying to identify the second duplicate combinations of cells across two (or more) columns. Complicating matters, the order of combinations varies.
To illustrate - my data looks something like this:
aaa 111
222 aaa
111 aaa
111 bbb
bbb 111
I'm looking for a formula that for this example would tell me that rows 1, 2 and 4 are the first instances of the combined values, whereas rows 3 and 5 are the second instances.
If you don't mind adding another column to the sheet, you can create an "index" for each row, making sure you always list the columns in the same order. (You can always copy values and delete the intermediary column.)
For example the following formula:
=IF($A1<$B1,CONCATENATE($A1,"!",$B1),CONCATENATE($B1,"!",$A1))
Will create a unique identifier like the following, using a ! character for a delimiter:
aaa 111 111!aaa
222 aaa 222!aaa
111 aaa 111!aaa
111 bbb 111!bbb
bbb 111 111!bbb
Then it's just a matter of using COUNTIF, for example with the index in column C:
=COUNTIF($C$1:$C1,$C1)
This will produce the following sheet, the number being the ordinal 1-based count of how many times that pair has appeared.
aaa 111 111!aaa 1
222 aaa 222!aaa 1
111 aaa 111!aaa 2
111 bbb 111!bbb 1
bbb 111 111!bbb 2
Someone with more time on their hands can probably come up with an array formula to do the same thing in memory.

Resources