Return 1st value of duplicates based on multiple criterias

dellzy

Board Regular
Joined
Apr 24, 2013
Messages
146
Hi Experts,
Would need to have output as shown below. I am trying to figure out the right formula to be applied in Col "Output" to return value of ColB (those match in namedrange Members) when it finds first time match based on same value in ColA and the earliest datetime in ColC. For example, for data range with same value Tix123, at the earliest datetime in datarange ColC, output should be mectr at row6 because mectr is one of the values in "Members", listed at the earliest datetime 28/12/2015 10:59. So far, my trial and error on the formula only allows me to return the first value in ColB that matches in "Members" and ignores the rest duplicates regardless the Tix number in ColA or the datetime in ColC. Appreciate if anyone can modify my formula below to suit the criterias:-


My current formula in col "Output" : =IFERROR(IF(COUNTIF($B$2:$B$79,B2)=1,"",IF(AND((COUNTIF($B$2:B2,B2)=1)=TRUE,MATCH(B2,Members,0),MATCH(A2,$A$2:$A$79,0)),B2,"")),"")

NamedRange : "Members"
Values in "Members" are Wgbiz and mectr

(expected)
ColA ColB ColC Output
Tix123 Wgbiz 7/12/2015 19:55
Tix123 hizter 2/12/2015 9:22
Tix123 Wgbiz 2/12/2015 9:22
Tix123 mectr 29/12/2015 15:53
Tix123 spectra 25/12/2015 10:57
Tix123 mectr 28/12/2015 10:59 mectr
Tix123 Wgbiz 1/12/2015 10:13 Wgbiz
Tix123 spectra 7/12/2015 10:13
Tix999 hizter 23/12/2015 15:53
Tix999 mectr 28/12/2015 18:36
Tix999 hizter 7/12/2015 10:13
Tix999 mectr 7/12/2015 10:13 mectr
Tix999 Wgbiz 23/12/2015 15:53 Wgbiz​
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Care to post a scaled down input sample along with the expected output?

That (expected) in red was misleading...

Row\Col
A​
B​
C​
D​
1​
Output
2​
Tix123Wgbiz
12/8/2015 15:50​
3​
Tix123hizter
12/2/2015 18:44​
4​
Tix123Wgbiz
12/2/2015 18:44​
5​
Tix123mectr
12/30/2015 7:46​
6​
Tix123spectra
12/25/2015 21:54​
7​
Tix123mectr
12/28/2015 21:58​
mectr
8​
Tix123Wgbiz
12/1/2015 20:26​
Wgbiz
9​
Tix123spectra
12/7/2015 20:26​
10​
Tix999hizter
12/24/2015 7:46​
11​
Tix999mectr
12/29/2015 13:12​
12​
Tix999hizter
12/7/2015 20:26​
13​
Tix999mectr
12/7/2015 20:26​
mectr
14​
Tix999Wgbiz
12/24/2015 7:46​
Wgbiz

Care to confirm that the output above is correct?
 
Upvote 0
Hi,Aladin,
Spectra is not an expected output because Spectra is not one of the values in namedrange Members
 
Upvote 0
Hi,Aladin,
Spectra is not an expected output because Spectra is not one of the values in namedrange Members

Right. That means Members consists of just Wgbiz and mectr as you indeed state in your original post.

One more question: Why is the output Wgbiz at row 14 correct for this just occurs once in association with Tix999?
 
Upvote 0
Hi Aladin,
Wgbiz at row 14 should be correct because that's the first occurrence and considered as the earliest among all that associates with Tix999.

Hopefully the above clarifies.

Thank you.
 
Upvote 0
Hi Aladin,
Wgbiz at row 14 should be correct because that's the first occurrence and considered as the earliest among all that associates with Tix999.

Hopefully the above clarifies.

Thank you.

{=IF($C2=MIN(IF($A$2:$A$14=$A2,IF(ISNUMBER(MATCH($B$2:$B$14,members,0)),IF($B$2:$B$14=$B2,$C$2:$C$14)))),$B2,"")}

which does not test whether the A range is empty/blank.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,867
Members
449,053
Latest member
Mesh

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