Formula in the helper column. need duplicate to be count as One

Lukma

Active Member
Joined
Feb 12, 2020
Messages
259
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Good day Friends

Need help with the formula in my Helper column in Column B,
I have joined Column D & Column G and did a count with it.
the help I need in this formula is that if the Mus no is the same and the Port name repeats then it should still count as as one

1709871651014.png


Need the formula to provide me with this count if it is duplicate count it as one
1709871762997.png


Appreciate your help and support

Regards

OTD Data Extraction from Jan - Feb 2024.xlsx
BCDEFG
3Help columnMonthMUS No:Vessel NamePort Name
4 & Rig Yemillah 0Jan Rig YemillahRig Yemillah
5 & Umm Al Anbar 0Jan Umm Al Anbar Island-AD68Umm Al Anbar
6 & Jopetwill-300 0Jan Barge JOPET WILL-300Jopetwill-300
7 Jan Umm Shaif Field#N/A
8236 & Rig Al Sila 1Jan236MARCAP-203Rig Al SilaRig Al Sila
9 & Rig Al Gharbia 0Jan Rig Al GharbiaRig Al Gharbia
10146 & Al Qatia Island 1Jan146ADNOC-1010Al Qatia Island-AD78Al Qatia Island
11194 & Rig Al Hudairiyat 1Jan194MARSOL SCAMANDERRig Al HudairiyatRig Al Hudairiyat
12 & Barge Shammal 1Jan Barge ShammalBarge Shammal
13283 & Rig Al Lulu 1Jan283B-GULF-101Rig Al LuluRig Al Lulu
14334 & Al Qatia Island 1Jan334WARDEH-1Al Qatia Island-AD78Al Qatia Island
15578 & Rig Al Saadiyat 1Jan578STANFORD ALPHARig Al SaadiyatRig Al Saadiyat
16406 & Rig Vivekanand-3 1Jan406ADNOC-223Rig VKN 3Rig Vivekanand-3
17451 & Rig Al Jubail 1Jan451ADNOC-A02Rig Al JubailRig Al Jubail
18 & Rig Al Jubail 1Jan Rig Al JubailRig Al Jubail
19578 & Rig Al Saadiyat 2Jan578STANFORD ALPHARig Al SaadiyatRig Al Saadiyat
20 & Rig Al Jubail 2Jan Rig Al JubailRig Al Jubail
2169 & Rig Vivekanand-3 1Jan69MARCAP-203Rig VKN 3Rig Vivekanand-3
2255 & Rig Muhaiyimat 1Jan55ADNOC-229Rig MuhaiyimatRig Muhaiyimat
23541 & ACPT 1Jan541ADNOC-850ACPT ComplexACPT
24236 & Rig Al Sila 2Jan236MARCAP-203Rig Al SilaRig Al Sila
2531 & Rig Al Bateel 1Jan31MUTAWA-402Rig Al BateelRig Al Bateel
2631 & Rig Al Bateel 2Jan31MUTAWA-402Rig Al BateelRig Al Bateel
CargoRequests (3)
Cell Formulas
RangeFormula
B4:B26B4=IFERROR(D4&" & "&G4&" "&COUNTIFS(D$4:D4,D4,G$4:G4,G4),"")
E4:E26E4=IFERROR(VLOOKUP(D4,'[2024 - VESSELS ONSHORE JETTY OPERATIONS.xlsx]2023-Vessel Onshore Operations'!$D$4:$G$60000,2,0),"")
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Should "236 & Rig Al Sila 2" in row 24 appear with a 1 or 2? Same question for row 19...should it also have a 1 rather than a 2?

It seems that, based on your description, every row would result in a 1...every row is either a unique combination of a MUS No and a Port name (therefore a count of 1) or it is a repeated combination of MUS No/Port name shown above it (which is to be limited to a count of 1).

Also, the use of COUNTIFS is puzzling. For the first four rows, the MUS No. cells are blank, so does a blank MUS No. and any Port name count as 1?...you show those as 0. Rows 4-7 and 9 return the expected result for COUNTIFS...if the cell is blank, there is nothing to count, so COUNTIFS delivers a 0. Yet rows 12, 18, and 20 are counting the apparently blanks cells...so something is different...are those cells actually blank? Why do some apparently blank cells deliver a count and others do not?
 
Upvote 0
Dear Krice

Yes if it's repeated for the same MUS No: then I want it to count as 1 for the same example for what i need below

many thanks

1709879136491.png
 
Upvote 0
Dear Krice

Thanks if the cell is blank I don't need it to count because this is the master data with items, so my idea is to number them while as one even if port name is repeated in same Mus No;
so it should still count it or number as one.

regards
 
Upvote 0
Okay...thank you. That's different from your first post, but the 1's in the orange cells make sense. So that still leaves the question about the different behavior with blank cells. Why do some blanks give counts of 0 and other blanks give counts of 1 or 2?
 
Upvote 0
If blanks are not to be counted, then you do not need a counting formula at all, do you? You just need to check whether the column E cell has something in it, and if so, then "1", otherwise "0". I've isolated the COUNTIFS formula in column J (note that all blank MUS No cells result in 0). Compare those results to a simple --(E<>"") formula in column I to see if those are the values you expect.
MrExcel_20240305.xlsx
BCDEFGHIJ
3Help columnMonthMUS No:Vessel NamePort Name
4 & Rig Yemillah 0Jan Rig YemillahRig Yemillah00
5 & Umm Al Anbar 0Jan Umm Al Anbar Island-AD68Umm Al Anbar00
6 & Jopetwill-300 0Jan Barge JOPET WILL-300Jopetwill-30000
7 Jan Umm Shaif Field#N/A00
8236 & Rig Al Sila 1Jan236MARCAP-203Rig Al SilaRig Al Sila11
9 & Rig Al Gharbia 0Jan Rig Al GharbiaRig Al Gharbia00
10146 & Al Qatia Island 1Jan146ADNOC-1010Al Qatia Island-AD78Al Qatia Island11
11194 & Rig Al Hudairiyat 1Jan194MARSOL SCAMANDERRig Al HudairiyatRig Al Hudairiyat11
12 & Barge Shammal 0Jan Barge ShammalBarge Shammal00
13283 & Rig Al Lulu 1Jan283B-GULF-101Rig Al LuluRig Al Lulu11
14334 & Al Qatia Island 1Jan334WARDEH-1Al Qatia Island-AD78Al Qatia Island11
15578 & Rig Al Saadiyat 1Jan578STANFORD ALPHARig Al SaadiyatRig Al Saadiyat11
16406 & Rig Vivekanand-3 1Jan406ADNOC-223Rig VKN 3Rig Vivekanand-311
17451 & Rig Al Jubail 1Jan451ADNOC-A02Rig Al JubailRig Al Jubail11
18 & Rig Al Jubail 0Jan Rig Al JubailRig Al Jubail00
19578 & Rig Al Saadiyat 2Jan578STANFORD ALPHARig Al SaadiyatRig Al Saadiyat12
20 & Rig Al Jubail 0Jan Rig Al JubailRig Al Jubail00
2169 & Rig Vivekanand-3 1Jan69MARCAP-203Rig VKN 3Rig Vivekanand-311
2255 & Rig Muhaiyimat 1Jan55ADNOC-229Rig MuhaiyimatRig Muhaiyimat11
23541 & ACPT 1Jan541ADNOC-850ACPT ComplexACPT11
24236 & Rig Al Sila 2Jan236MARCAP-203Rig Al SilaRig Al Sila12
2531 & Rig Al Bateel 1Jan31MUTAWA-402Rig Al BateelRig Al Bateel11
2631 & Rig Al Bateel 2Jan31MUTAWA-402Rig Al BateelRig Al Bateel12
CargoRequests
Cell Formulas
RangeFormula
I4:I26I4=--(E4<>"")
J4:J26J4=COUNTIFS(D$4:D4,D4,G$4:G4,G4)
B4:B26B4=IFERROR(D4&" & "&G4&" "&COUNTIFS(D$4:D4,D4,G$4:G4,G4),"")
E4:E26E4=IFERROR(VLOOKUP(D4,'2023-Vessel Onshore Operations'!$D$4:$G$60000,2,0),"")
 
Upvote 0
Solution
Dear Krice

Thanks, column I did exactly what I needed, but I need to join the MUS No: with the Port Name as this is for a different MUS no

so I don't mind if the empty cell is not blank my main concern is focusing on the Mus No and Port name.

so is there any way around this?

Regards
 
Upvote 0
but I need to join the MUS No: with the Port Name as this is for a different MUS no
I don't understand what you mean. If you mean you need to join the text together as you have done in B4 and down, then replace the B4 formula with:
Excel Formula:
=D4&" & "&G4&" "&--(E4<>"")
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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