Formula solution to extract unique based on 2 criteria name and month

Lukma

Board Regular
Joined
Feb 12, 2020
Messages
240
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi Guys

I came across this formula here and i was wondering how to go about it which am not sure, so i decided have a play around the formula to extract the unique voyage no based on 2 criteria the name and month.

My Aim is to extract total voyage made for each name so i consider that at most each name can make 10 trips with different voyage number

in Column A i have the month format, then column B I have the voyage listed with duplicate, in column F2 i have predicted that for each name at least 10 trips in a month and in column F1 will be creating a drop down to select month so my idea is that in column G2 i need to extract the unique Voyage for each name without duplicate base on criteria for every month.

i will be very happy is this formula have answer to that and also if there is better solution without the use of array formula to extract the unique voyage

Book2
ABCDEFGH
1Month 01-Jan-21Extract Unique Voyage Base 2 Criteria Name and Month
2Voyage NoName maximum Trip in a Month 10 to 11 for each Name Voyage No
301-Jan-213705ADNOC-8101ADNOC-810#N/A
401-Jan-213705ADNOC-8102ADNOC-810
501-Jan-213705ADNOC-8103ADNOC-810
601-Jan-213705ADNOC-8104ADNOC-810
701-Jan-213706ADNOC-2245ADNOC-810
801-Jan-213706ADNOC-2246ADNOC-810
901-Jan-213706ADNOC-2247ADNOC-810
1001-Jan-213706ADNOC-2248ADNOC-810
1101-Jan-213706ADNOC-2249ADNOC-810
1201-Jan-213666-OASL SWIFT10ADNOC-810
1301-Jan-213666-OASL SWIFT1ADNOC-224
1401-Jan-213666-OASL SWIFT2ADNOC-224
1501-Jan-213707Z-POWER3ADNOC-224
1601-Jan-213707Z-POWER4ADNOC-224
1701-Jan-213707Z-POWER5ADNOC-224
1801-Jan-213707Z-POWER6ADNOC-224
1901-Jan-213707Z-POWER7ADNOC-224
2001-Jan-213708SMIT LUZON8ADNOC-224
2101-Jan-213708SMIT LUZON9ADNOC-224
2201-Jan-213708SMIT LUZON10ADNOC-224
2301-Jan-213709SMIT LUMUT
2401-Jan-213709SMIT LUMUT
2501-Jan-213709SMIT LUMUT
2601-Jan-213709SMIT LUMUT
2701-Jan-213710B-LIBERTY-313
2801-Jan-213710B-LIBERTY-313
2901-Jan-213710B-LIBERTY-313
3001-Jan-213710B-LIBERTY-313
3101-Jan-213710B-LIBERTY-313
3201-Jan-213711MAC PHOENIX
3301-Jan-213711MAC PHOENIX
3401-Jan-213712ADNOC-812
3501-Jan-213713A-HERCULES
3601-Jan-213713A-HERCULES
3701-Jan-213713A-HERCULES
3801-Jan-213713A-HERCULES
3901-Jan-213713A-HERCULES
4001-Jan-213713A-HERCULES
Sheet1
Cell Formulas
RangeFormula
G3G3=IF(C3="","",INDEX(B3:B40,MATCH(ROWS(G$3:G3),C3:C40,0)))
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
This would be much easier if you had the dynamic array functions at your disposal.

One alternative to the more complex formulas needed for your version of excel would be to use a pivot table instead. This was created from the data in columns A:C with a few clicks. The date can be selected from the dropdown filter located in F1
Book1 (version 1).xlsx
EFG
1Date01 Jan 21
2
3Name Voyage NoCount of Voyage No
4ADNOC-22437065
5ADNOC-81037054
6ADNOC-81237121
7A-HERCULES37136
8ASL SWIFT3666-O3
9B-LIBERTY-31337105
10MAC PHOENIX37112
11SMIT LUMUT37094
12SMIT LUZON37083
13Z-POWER37075
Sheet6
 
Upvote 0
Solution
Hi LUKMA,

How about?

Book2
ABCDEFGH
1Month 1-Jan-21Extract Unique Voyage Base 2 Criteria Name and MonthUnique count
2DateVoyage NoName maximum Trip in a Month 10 to 11 for each Name Voyage No 10
31-Jan-213705ADNOC-8101ADNOC-8103705
41-Jan-213705ADNOC-8102ADNOC-8103706
51-Jan-213705ADNOC-8103ADNOC-8103666-O
61-Jan-213705ADNOC-8104ADNOC-8103707
71-Jan-213706ADNOC-2245ADNOC-8103708
81-Jan-213706ADNOC-2246ADNOC-8103709
91-Jan-213706ADNOC-2247ADNOC-8103710
101-Jan-213706ADNOC-2248ADNOC-8103711
111-Jan-213706ADNOC-2249ADNOC-8103712
121-Jan-213666-OASL SWIFT10ADNOC-8103713
131-Jan-213666-OASL SWIFT1ADNOC-224 
141-Jan-213666-OASL SWIFT2ADNOC-224 
151-Jan-213707Z-POWER3ADNOC-224 
161-Jan-213707Z-POWER4ADNOC-224 
171-Jan-213707Z-POWER5ADNOC-224 
181-Jan-213707Z-POWER6ADNOC-224 
191-Jan-213707Z-POWER7ADNOC-224 
201-Jan-213708SMIT LUZON8ADNOC-224 
211-Jan-213708SMIT LUZON9ADNOC-224 
221-Jan-213708SMIT LUZON10ADNOC-224 
231-Jan-213709SMIT LUMUT 
241-Jan-213709SMIT LUMUT 
251-Jan-213709SMIT LUMUT 
261-Jan-213709SMIT LUMUT 
271-Jan-213710B-LIBERTY-313 
281-Jan-213710B-LIBERTY-313 
291-Jan-213710B-LIBERTY-313 
301-Jan-213710B-LIBERTY-313 
311-Jan-213710B-LIBERTY-313 
321-Jan-213711MAC PHOENIX 
331-Jan-213711MAC PHOENIX 
341-Jan-213712ADNOC-812 
351-Jan-213713A-HERCULES 
361-Jan-213713A-HERCULES 
371-Jan-213713A-HERCULES 
381-Jan-213713A-HERCULES 
391-Jan-213713A-HERCULES 
401-Jan-213713A-HERCULES 
Sheet1
Cell Formulas
RangeFormula
H2H2=SUM(IF(FREQUENCY(IF($B$3:$B$40<>"",IF($A$3:$A$40=$E$1,MATCH("~"&$B$3:$B$40,$B$3:$B$40&"",0))),ROW($B$3:$B$40)-ROW($B$3)+1),1))
F3:F12F3=IF(ROWS(F$3:F3)>$H$2,"",INDEX($B$3:$B$40,SMALL(IF(FREQUENCY(IF($B$3:$B$40<>"",IF($A$3:$A$40=$E$1,MATCH("~"&$B$3:$B$40,$B$3:$B$40&"",0))),ROW($B$3:$B$40)-ROW($B$3)+1),ROW($B$3:$B$40)-ROW($B$3)+1),ROWS(F$3:F3))))
F13:F40F13=IF(ROWS(F$3:F13)>$H$2,"",INDEX($B$3:$B$40,SMALL(IF(FREQUENCY(IF($B$3:$B$40<>"",MATCH("~"&$B$3:$B$40,$B$3:$B$40&"",0)),ROW($B$3:$B$40)-ROW($B$3)+1),ROW($B$3:$B$40)-ROW($B$3)+1),ROWS(F$3:F13))))
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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