#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default need help


Hi,

I have, say, three columns and ten rows data, so totally thirty cell
of data. And some of the data appeared once, twice, three times or eve
four times.
What I need to do is assign a unique number to each row. If the sam
data appeared twice in two rows, these two rows will share the sam
unique number.If the same data appeared three times, these one, two o
three rows will share the same unique number.....
I am not sure if this can be done by VBA, say, if the data siz
increase in the future.
Anyone can help me or give me some hints?
Thanks a lot

--
austanle
-----------------------------------------------------------------------
austanley's Profile: http://www.excelforum.com/member.php...fo&userid=3592
View this thread: http://www.excelforum.com/showthread.php?threadid=56933

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default need help

You could just loop over your cells and have it count the number of things
that you're looking for in each row. If you set up a loop using two
variables, let's say i and j you could have something like

for i = 1 to 10
for j = 1 to 3
'your code here
next j
next i

where it would look over the data going (in this case rows then columns).
You could then do whatever you want by using an if statement in the middle,
or just using an increment. It's hard to tell what exactly you're looking
for, but this might give you an idea of something to try. And instead of 1
to 10, you could always change it to something like 1 to
excel.worksheetfunction.counta(rows(1)) or something so that it will expand
as your data expands.

Cheers,

Scott



"austanley" wrote:


Hi,

I have, say, three columns and ten rows data, so totally thirty cells
of data. And some of the data appeared once, twice, three times or even
four times.
What I need to do is assign a unique number to each row. If the same
data appeared twice in two rows, these two rows will share the same
unique number.If the same data appeared three times, these one, two or
three rows will share the same unique number.....
I am not sure if this can be done by VBA, say, if the data size
increase in the future.
Anyone can help me or give me some hints?
Thanks a lot!


--
austanley
------------------------------------------------------------------------
austanley's Profile: http://www.excelforum.com/member.php...o&userid=35921
View this thread: http://www.excelforum.com/showthread...hreadid=569339


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



All times are GMT +1. The time now is 08:47 PM.

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"