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

2 questions - Text File example:

Account,Status,Val
001,NB,0
001,PI,50
001,PI,100
001,CE,100
002,PE,500
002,PI,250
002,PU,0
002,PU,0
003,PE,100
003,CE,100
I would like to pick up ALL records of any account where there is NO CE
status and write it out to a separate file i.e.
002,PE,500
002,PI,250
002,PU,0
002,PU,0

I would like to pick up the LAST record of any account where PU = 0 i.e.
002,PU,0
and write it out to a separate file.

It is easy to do this using a database but a need has arisen to do it
upfront i.e before importing the data into the database and I thought a
simple VBA app will suffice. I know how to access the file, how to loop
through it and how to write out records to a new file but in this case there
is one or two aspects that I need some help with (eg how to "step back" to
pick up the other records once the required condition is met).

Hil


  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Selecting records

Hi,
Do not know about stepping back in the file once you
have started reading it. One way to solve your problem
could be to read the file and store it in a matrix,
account names with CE record in a separate vector and
account names with PU = 0 to a second vector. Then loop
through the matrix and select records based on your
criteria using the two vectors and direct output to
different files accordingly.

ojv
-----Original Message-----
2 questions - Text File example:

Account,Status,Val
001,NB,0
001,PI,50
001,PI,100
001,CE,100
002,PE,500
002,PI,250
002,PU,0
002,PU,0
003,PE,100
003,CE,100
I would like to pick up ALL records of any account where

there is NO CE
status and write it out to a separate file i.e.
002,PE,500
002,PI,250
002,PU,0
002,PU,0

I would like to pick up the LAST record of any account

where PU = 0 i.e.
002,PU,0
and write it out to a separate file.

It is easy to do this using a database but a need has

arisen to do it
upfront i.e before importing the data into the database

and I thought a
simple VBA app will suffice. I know how to access the

file, how to loop
through it and how to write out records to a new file

but in this case there
is one or two aspects that I need some help with (eg how

to "step back" to
pick up the other records once the required condition is

met).

Hil


.

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
selecting records Roy Gudgeon[_2_] Excel Discussion (Misc queries) 2 March 9th 10 10:30 AM
Selecting Random Records From an Excel Sreadsheet Trevor Aiston[_2_] Excel Worksheet Functions 3 June 29th 09 11:20 AM
Delete records when certain records have duplicate column data JVroom New Users to Excel 1 January 26th 09 06:23 PM
selecting random records terry freedman Excel Programming 2 April 2nd 04 11:07 AM
Selecting Filtered records only when AutoFilter is on Owen Vickers Excel Programming 4 February 21st 04 02:20 AM


All times are GMT +1. The time now is 02:12 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"