PC Review


Reply
Thread Tools Rate Thread

counter script

 
 
=?Utf-8?B?Um9iZXJ0?=
Guest
Posts: n/a
 
      23rd Mar 2007
Hello,

I need a counter script that can turn this input. I need the number of
inspections to be the number of unique dates. Thanks. (E-Mail Removed)

Name Inspection Date
ABC Trucking 1/1/2006
ABC Trucking 1/1/2006
ABC Trucking 1/23/2006
ABC Trucking 1/23/2006

into this output

Name Most recent inspection # of inspections
ABC Trucking 1/23/2006 2

 
Reply With Quote
 
 
 
 
matt
Guest
Posts: n/a
 
      23rd Mar 2007
On Mar 22, 8:08 pm, Robert <Rob...@discussions.microsoft.com> wrote:
> Hello,
>
> I need a counter script that can turn this input. I need the number of
> inspections to be the number of unique dates. Thanks. rzito...@yahoo.com
>
> Name Inspection Date
> ABC Trucking 1/1/2006
> ABC Trucking 1/1/2006
> ABC Trucking 1/23/2006
> ABC Trucking 1/23/2006
>
> into this output
>
> Name Most recent inspection # of inspections
> ABC Trucking 1/23/2006 2


Why not sort the data according to date in ascending order? You can
then delete all rows below the most recent date.

For example, after sorting the data you could write something like
this: (This hasn't been tested).

sub xxx()
Dim a
Dim counter
Dim currentDate
Dim nextDate
Dim strAdd
Dim endAdd

counter = Range("a1").currentregion.rows.count

for a = 1 to counter
currentDate = Range("c" & a).value
nextDate = range("c"&a).offset(1,0).value

if currentDate <> nextDate Then
exit for
end if
next

activecell.offset(1,0).select
strAdd = selection.address
selection.end(xldown).select
endAdd = selection.address

range(stradd & ":" & endadd).entirerow.delete

counter = Range("a1").currentregion.rows.count
range("e1").value = "count is " & counter

end sub

matt

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inbox Unread Blue Counter and Deleted Items Counter. Chris Baldassano Microsoft Outlook Discussion 1 20th Oct 2008 05:18 PM
Re: user-friendly hit counter script Steve Easton Microsoft Frontpage 0 7th Dec 2006 10:54 PM
Re: user-friendly hit counter script Jon Spivey Microsoft Frontpage 0 7th Dec 2006 10:22 PM
access counter / hit counter not based on page reloads? Chuck Chopp Microsoft Frontpage 3 9th Feb 2005 10:30 AM
cgi script counter mystery Julian Windows XP Internet Explorer 0 16th Feb 2004 11:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:40 PM.