Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default VBa code to select from worksheet

I don't understand your pseudo code but I think your first list pretty much
exposes a reasonable path to creating the second list. Your first list is
almost sorted by date as a primary sort key and status as a secondary sort
key. If it were really sorted the CANCEL transaction would be first. Once
sorted it is a simple matter to iterate through the list, count consecutive
identical entries, and output items in the 2nd list. Unfortunately Excel
VBA doesn't have a sort function (or maybe I never found it) so I typically
use a fairly simple bubble sort that is implemented in about 10 lines of
code. Your sort would be a little more complex because you have two keys
but you can easily form a single pseudo key out of the two keys and sort on
the pseudo key.

Note that you might be able to invoke a spreadsheet function to do the
sorting but I never thought that writing my own sort was difficult enough to
motivate me to look at that option.

Luke

"mike" wrote in message
ups.com...
I have some columns like this below except that there are 700 rows.

Date Status
3/7/2006 CLOSED
3/7/2006 CLOSED
3/7/2006 CANCEL
3/7/2006 OPEN
3/7/2006 OPEN
3/7/2006 OPEN

I need to be able to produce output like this:

Date Status Count
3/7/2006 CLOSED 2
3/7/2006 CANCEL 1
3/7/2006 OPEN 3

I was wondering if excel can do something like:

select a, b, count(a) as c
from worksheet1
group by a, b

Any chance?

Mike



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
VB select code for a worksheet Vicki Excel Programming 3 December 8th 05 09:43 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM
How do I select this range using code....another try at it. TBA[_3_] Excel Programming 2 January 14th 04 11:13 PM
Code to Select Row David McRitchie[_2_] Excel Programming 0 September 19th 03 11:02 PM


All times are GMT +1. The time now is 03:38 AM.

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

About Us

"It's about Microsoft Excel"