Count how many entrances in column A have different entrances in column B?

SofiaV

New Member
Joined
Jan 18, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm trying to find a formula that counts the entrances in a column that have different entrances in the next column.

For example, if I count how many ship in column "Ship" have Charged and Discharged the result must be 2 (Ships T and B)

Thanks in advance,
Sofia
ShipCharges/Discharge
TC
BD
SC
EC
EC
EC
EC
EC
EC
EC
IC
BC
TD
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Noting that ship 'E' has 7 charges and 0 discharges, if you subsequently add 4 discharges 4 ship 'E' to the list, should that be counted as
4 (count once for each pair of charge and discharge)?
1 (count once because all are the same ship)?
0 (don't count because there are unequal entries for charge and discharge)?
Or something completely different?

Similarly, what if there were 7 charges and 7 discharges for ship 'E', how should it be counted?
 
Upvote 0
I think you can only Discharded at second Column.
Excel Formula:
=COUNTIF($B$2:$B$14,"D")
 
Upvote 0
@maabadi's suggestion above will count all discharge entries (multiple entries for the same ship will all be counted), this matches up to the first query that I mentioned in my earlier reply.

This formula will count unique discharge entries (a ship discharged multiple times will only be counted once), this matches up to the second query that I mentioned in my earlier reply.
Excel Formula:
=ROWS(UNIQUE(FILTER(A2:B14,B2:B14="D")))
If you need a formula that matches up to the third query in my earlier reply, or something else entirely then that will need something a little more creative.

Note that neither formula will catch erroneous entries, in the event that a ship is discharged without charge it will still be counted.

With many things in excel formulas, it is the small details that make the big difference between something that works and something that works properly.
 
Upvote 0
Noting that ship 'E' has 7 charges and 0 discharges, if you subsequently add 4 discharges 4 ship 'E' to the list, should that be counted as
4 (count once for each pair of charge and discharge)?
1 (count once because all are the same ship)?
0 (don't count because there are unequal entries for charge and discharge)?
Or something completely different?

Similarly, what if there were 7 charges and 7 discharges for ship 'E', how should it be counted?
Hi Jasonb,

Thank you for your help. For now, I would like the result to be 1 because I need to know How many ships have made different movements.
 
Upvote 0
In that case the formula in post 4 should do what you need.
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,728
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