![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Arkansas
Posts: 157
|
Good morning,
I have 2 columns of data. Column A has a date, and column 2 has a truck/trailer number. I want the total # of trucks, but if there is a duplicate date AND truck/trailer, then count it as one. 1/2/02 333344 1/2/02 333344 (this would be a count of 1) Can anyone tell me how to do this? Thank you in advance. |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: May 2002
Posts: 13,278
|
A horribly inelegant way to do it could be to concatenate the 2 colums & the count the unique results.
Not pretty, just simple... Paddy |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,805
|
Quote:
Here is a simple way to do it using Advance Filter. 1) From Toolbar select Data | Filter | Advance Filter. 2) In "List Range" enter your 2 column range including titles. 3) Leave the "Criteria Range" field empty. 4)Tick on check box "Unique Records Only" and press OK. Data will be filtered on unique records. 5) Now subtotal column B with the formula: =SUBTOTAL(2,[your B column range]) Tell me if you succeeded. Eli [ This Message was edited by: eliW on 2002-05-14 09:03 ] |
|
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Arkansas
Posts: 157
|
DADDYP,
How would I total on unique items only? |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Quote:
where 2 means COUNT. Did you try Eli's proposal? |
|
|
|
|
|
|
#6 |
|
MrExcel MVP
Join Date: May 2002
Posts: 13,278
|
To the best of my knowledge I'm not a daddy yet...
Simple way to generate the subtotal: Highlight the combined column (make sure it's got a column heading), select Data...Subtotals. select 'Count' from the 'Use fuctions' drop down. Collapse the groups to see just the totals. Paddy |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
Date TruckNo 1/2/02 333344 1/2/02 333343 1/2/02 333344 1/1/02 333345 1/1/02 333344 then let us put the following criterion, say in cell D2 =NOT(AND(A3=A4,B3=B4)) Now using the following formula =DCOUNT(A2:B7,1,D1:D2) will give me the unique count of the Date_TruckNo combinations Please post back if it works for you ... otherwise explain a little further and let us take it from there! |
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 50,317
|
Yogi,
I don't think that DCOUNT will work. Try it on: {"Date","TruckNo";37257,333345;37257,333344;37258,333344;37258,333343;37258,333344;37258,333344;37258,333343} Aladin |
|
|
|
|
|
#9 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Quote:
Works for me -- if I copied your data correctly, using my DCOUNT function, I got 4. What did you get using my DCOUNT function -- and if you got an error or if you got another message, please post! Regards |
|
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Apr 2002
Location: Arkansas
Posts: 157
|
Thanks for getting back to me. I'll give it a try tomorrow at work, and let you know.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|