Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Duplicate Count

I'm writing a macro that will loop through a table of data and count how many
duplicates there are on a given day as defined by user entered range. The
code below works for the 1st date but displays 0 for the remaining dates. Any
help would be appreciated.

Dim enteredDate As Date 'Start Date entered by user
Dim rawDataDate As Date 'Variable date as seen on BAS raw data

' Gets user inputed start date from main page
enteredDate = Workbooks("QDS").Sheets("Sheet1").Cells(5, 3).Value

' Count of days between user selected start and end dates
numDays = Workbooks("QDS").Sheets("Sheet1").Cells(7, 3).Value - _
Workbooks("QDS").Sheets("Sheet1").Cells(5, 3).Value

For i = 1 To numDays
dupecount = 0
Do While Cells(x, 2).Value < ""
rawDataDate = Cells(x, 12).Value
If Cells(x, 2).Value = Cells(y, 2).Value And DateDiff("d",
rawDataDate,enteredDate) = 0 Then
dupecount = dupecount + 1
End If
x = x + 1
y = y + 1

Loop
Workbooks("QDS").Sheets("Sheet2").Cells(i, 2).Value = dupecount
enteredDate = enteredDate + 1
Next

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Duplicate Count

Hello,

Maybe my UDF lfreq can serve as an example for you:
http://www.sulprobil.com/html/listfreq.html

Regards,
Bernd
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Duplicate Numbers farid2001 Excel Worksheet Functions 4 September 22nd 08 08:04 AM
Count Duplicate Values Abdul Shakeel Excel Discussion (Misc queries) 2 February 29th 08 04:31 PM
Count Number of Duplicate Occurances Scott Halper Excel Worksheet Functions 7 March 30th 07 03:42 PM
How do I do a count sum that ignores duplicate items Robin Faulkner Excel Worksheet Functions 2 February 17th 05 11:53 AM
get count of row without duplicate entries Aananth Excel Worksheet Functions 2 October 29th 04 06:09 PM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"