formatting question

M

microsoft.news.com

I'm creating a Excel spreadsheet on the fly using C# with data from a text
file.
My question is how can I add Groups to the spreadsheet and add some
formatting?

Example:
my text file has cars in it (these can change daily)
BMW
Lexus
VW
GM
Chevy

so in my excel file how can i show
BMW



Lexus



VW


Gm


Chevy

and show information pertaining to that make of car? I have dates, prices,
etc for each make. I want to group them all together so i don't see BMW 20
times or VW 20 times, I want to see BMW, VW once and then show all the data
linked to the make.
 
G

Guest

Hi,
You are going to have to be more specific. What information are you trying
to link to? What fields will be in the linked files? Does the text file only
contain the general make of a vehicle? To link to another file you will need
a unique ID for each text record, like the VIN number to do a lookup to and
pull specific information. You might be able to set something up on a FIFO
inventory basis or something similar to that, if all you have is the general
make.

Thanks,
 
M

microsoft.news.com

my data in the text file looks like this:

BMW1999 325CI VIN123456789101236JohnSmith 4500020051212
Lexus2004ES300 VIN123456789101236BarneyRubble 2566020051214
BMW2005 325C VIN123456789101236BettySmith 6950020050105

I'm already parsing it out, I just now want to group it by make
 
G

Guest

Hi,
If it is coming through s you indicate, only with more lines and vehicles,
it appears you could sort it as it is? The make is the first part of each
line, all the bmws, lexus, etc should group naturally. What have you
attempted so far? It may not be possible to answer your question with out
your specific data in a file. Once it is sorted, you have indicated you want
more things done? The only thing I see that is consistant and can be searched
in these strings in the letters "VIN", possibly there is consistancy in the
spacing? You want at this point to put specific information into columns?

Thanks,
 
M

microsoft.news.com

the data below is the acutal data coming from the text file. I have a C# app
that is getting the data and populating my excel spread sheet fine. But what
I want is to Group the Make and only see the make once in the spreadsheet
with all the data linked to it instead of seeing multiple lines for the
make.


in my excel file i'm seeing
BMW
BMW
Lexus
VW
BMW
Lexus

and I want
BMW
YEAR MAKE VIN who bought it when they bought it and price

Lexus
YEAR MAKE VIN who bought it when they bought it and price

I dont' want
BMW
BMW
Lexus
BMW
etc.
 
G

Guest

Hi,
Seems the best you will get is:
BMW:
Yr/Make/Vin/Who/When/Price
Yr/Make/Vin/Who/When/Price
Yr/Make/Vin/Who/When/Price

Lex
Yr/Make/Vin/Who/When/Price
Yr/Make/Vin/Who/When/Price
Yr/Make/Vin/Who/When/Price
Etc.
This is more parsing, based on the detail.
BMW1999 325CI VIN123456789101236JohnSmith 4500020051212
The line above would have to be worked on. Chances are someone would have to
work through enough examples to do this consistantly. The data all appears to
be there> probobly working through your real data is the only way someone
will really be able to help you. A lot Text functions and stuff to look at.

Thanks,
 
P

Peter T

Several approaches come to mind, eg
Gouped Outline
Pivot Table
Filters
Series of linked dropdown lists

With such little information it's difficult to suggest which to opt for,
though a table with filters is probably the easiest to set up.

Regards,
Peter T
 
S

STEVE BELL

Hi,

If column "A" contains the make than look through all entries in column A

For rw = Cells(Rows.COUNT, "A").End(xlUp).Offset(1, 0).row to 2 step -1
If cells(rw,1) = cells(rw-1,1) then
cells(rw,1).clearcontents
else = cells(rw,1)<>cells(rw-1)
Rows(rw).Insert
cells(rw,1)=cells(rw+1,1)
cells(rw+1,1).clear contents
end if
next

You will need additional code for row 1 if it also contains a car make.

add to end of code

Rows(1).Insert
cells(1,1)=cells(2,1)
cells(2,1).clear contents

rand451
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Can I have words representing numbers in a formula? 4
VLOOKUP or MATCH or Magical function 8
group dataset 4
add a new row 5
array question 8
Access Help with Access 2003 0
need some help 4
dual drop downs 1

Top