Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now
need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#2
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
in a cell to the right somewhere in row 1 type =If(A1="","",row(a1)),and copy
down,as long as a has something in it you will get the row number,this will work for al data as long as you dont insert rows.if you did insert a row say between 12 and 13 then the new row would be blank 12 would remain 12 and 13 would become 14,you could copy the formula down each row would be indentified but evrything below the inserted would be different than before...does that help? -- paul remove nospam for email addy! "Steve Barnett" wrote: I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#3
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Problem is the unique identifier needs to identify the row it was originally
attached to. When the user inserts new rows, the unique identifier must NOT change. I'm using this as a way of connecting rows in a spreadsheet to records in a database. Thanks Steve "paul" wrote in message ... in a cell to the right somewhere in row 1 type =If(A1="","",row(a1)),and copy down,as long as a has something in it you will get the row number,this will work for al data as long as you dont insert rows.if you did insert a row say between 12 and 13 then the new row would be blank 12 would remain 12 and 13 would become 14,you could copy the formula down each row would be indentified but evrything below the inserted would be different than before...does that help? -- paul remove nospam for email addy! "Steve Barnett" wrote: I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#4
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
When your only tool is a hammer, every problem looks like a nail. You are
hammering at this with the wrong tool, and exceeding the design capabilities of a spreadsheet. This needs to be converted to a table in a database. -- Ted |
#5
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
If only clients listened.
"TedMi" wrote in message ... When your only tool is a hammer, every problem looks like a nail. You are hammering at this with the wrong tool, and exceeding the design capabilities of a spreadsheet. This needs to be converted to a table in a database. -- Ted |
#6
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Steve,
To cover all the scenarios you mention might be impractical, but for what purpose/usage do you need unique row identifiers, in addition to the fact you can always read row numbers. Maybe you could define worksheet level named ranges, these would move as you insert rows though would end up with meaningless names for deleted ranges (#REF). Would you want 10k names though (but much better than 10k comments). If you were "allowed" to insert an extra column (hidden perhaps) populate with row numbers as values. Store the highest number somewhere (a cell or named formula). To cater for row inserts & new rows at the end, in selection and/or change events check the identifier cell has a value. If not increment the stored highest number and place same as the new identifier. But with the limitations imposed by your client you are a bit strapped! Regards, Peter T "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#7
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Afraid my suggestion about storing values etc doesn't cater for possibility
of entire row being copied ):- Peter T "Peter T" <peter_t@discussions wrote in message ... Hi Steve, To cover all the scenarios you mention might be impractical, but for what purpose/usage do you need unique row identifiers, in addition to the fact you can always read row numbers. Maybe you could define worksheet level named ranges, these would move as you insert rows though would end up with meaningless names for deleted ranges (#REF). Would you want 10k names though (but much better than 10k comments). If you were "allowed" to insert an extra column (hidden perhaps) populate with row numbers as values. Store the highest number somewhere (a cell or named formula). To cater for row inserts & new rows at the end, in selection and/or change events check the identifier cell has a value. If not increment the stored highest number and place same as the new identifier. But with the limitations imposed by your client you are a bit strapped! Regards, Peter T "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#8
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I also need to "keep" the unique identifier once it's been set.
The purpose behind this is that I need to copy some data from the spreadsheet in to a database. There is nothing in the rows of the spreadsheet that "uniquely" identifies it so there is nothing that I can hold on to that makes the connection between the row in the spreadsheet and the record in the database. Theory said that, if I could put a unique identifier in each row and, once set, that identifier didn't change (so I can't use row number) then I had something I could make the connection with. I wonder if I could fiddle it with named ranges? Wonder if this would work... Initially give a cell in every row a "name" (Say row-nnnnn). Then, when the user inserts rows and copies and pastes stuff around, the named range shouldn't change - it'll stick with the original cell. Then, when I close the spreadsheet, I scan down the column with the named ranges, checking to make sure that every row has a range name (if that's possible). If I find a cell without a name, I add one. Must go and play... Thanks Steve "Peter T" <peter_t@discussions wrote in message ... Afraid my suggestion about storing values etc doesn't cater for possibility of entire row being copied ):- Peter T "Peter T" <peter_t@discussions wrote in message ... Hi Steve, To cover all the scenarios you mention might be impractical, but for what purpose/usage do you need unique row identifiers, in addition to the fact you can always read row numbers. Maybe you could define worksheet level named ranges, these would move as you insert rows though would end up with meaningless names for deleted ranges (#REF). Would you want 10k names though (but much better than 10k comments). If you were "allowed" to insert an extra column (hidden perhaps) populate with row numbers as values. Store the highest number somewhere (a cell or named formula). To cater for row inserts & new rows at the end, in selection and/or change events check the identifier cell has a value. If not increment the stored highest number and place same as the new identifier. But with the limitations imposed by your client you are a bit strapped! Regards, Peter T "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#9
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
The "values" I suggested adding won't change. To initialise put the row
number as a value in each cell of a (hidden) column. In future events if there is no value the relative cell maybe something like - thisrowIDcellInColA = Application.Max(Columns("A")) + 1 But would need to figure something if user copy/pastes the entire row. Regards, Peter T "Steve Barnett" wrote in message ... I also need to "keep" the unique identifier once it's been set. The purpose behind this is that I need to copy some data from the spreadsheet in to a database. There is nothing in the rows of the spreadsheet that "uniquely" identifies it so there is nothing that I can hold on to that makes the connection between the row in the spreadsheet and the record in the database. Theory said that, if I could put a unique identifier in each row and, once set, that identifier didn't change (so I can't use row number) then I had something I could make the connection with. I wonder if I could fiddle it with named ranges? Wonder if this would work... Initially give a cell in every row a "name" (Say row-nnnnn). Then, when the user inserts rows and copies and pastes stuff around, the named range shouldn't change - it'll stick with the original cell. Then, when I close the spreadsheet, I scan down the column with the named ranges, checking to make sure that every row has a range name (if that's possible). If I find a cell without a name, I add one. Must go and play... Thanks Steve "Peter T" <peter_t@discussions wrote in message ... Afraid my suggestion about storing values etc doesn't cater for possibility of entire row being copied ):- Peter T "Peter T" <peter_t@discussions wrote in message ... Hi Steve, To cover all the scenarios you mention might be impractical, but for what purpose/usage do you need unique row identifiers, in addition to the fact you can always read row numbers. Maybe you could define worksheet level named ranges, these would move as you insert rows though would end up with meaningless names for deleted ranges (#REF). Would you want 10k names though (but much better than 10k comments). If you were "allowed" to insert an extra column (hidden perhaps) populate with row numbers as values. Store the highest number somewhere (a cell or named formula). To cater for row inserts & new rows at the end, in selection and/or change events check the identifier cell has a value. If not increment the stored highest number and place same as the new identifier. But with the limitations imposed by your client you are a bit strapped! Regards, Peter T "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#10
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Think I'm there.
I initialise the spreadsheet by going down every row and creating a range name (on a single cell in the row). I also save the range name in the cell comment, so they're both the same. When they are ready to submit the spreadsheet to me for processing, they run an update process that goes down each row and checks to see whether the range identified by the cell comment matches the current cell address. If it does, everything is great and this is the same (logical)row that it was before. It copes with the user inserting and deleting rows because I'm using a named range, which moves up and down accordingly. If the user inserts a new row and then copies an existing row in to it, the new row will not have a range name and the cell address referenced by the cell comment will not match the current cell, so I know this is a new row and I can generate a new unique identifier, a new range name and a new cell comment. I'm about half way through the code and it seems to be holding water so far. It's proving easier to code than to explain, I'm afraid. Thanks for all the help. Steve "Peter T" <peter_t@discussions wrote in message ... The "values" I suggested adding won't change. To initialise put the row number as a value in each cell of a (hidden) column. In future events if there is no value the relative cell maybe something like - thisrowIDcellInColA = Application.Max(Columns("A")) + 1 But would need to figure something if user copy/pastes the entire row. Regards, Peter T "Steve Barnett" wrote in message ... I also need to "keep" the unique identifier once it's been set. The purpose behind this is that I need to copy some data from the spreadsheet in to a database. There is nothing in the rows of the spreadsheet that "uniquely" identifies it so there is nothing that I can hold on to that makes the connection between the row in the spreadsheet and the record in the database. Theory said that, if I could put a unique identifier in each row and, once set, that identifier didn't change (so I can't use row number) then I had something I could make the connection with. I wonder if I could fiddle it with named ranges? Wonder if this would work... Initially give a cell in every row a "name" (Say row-nnnnn). Then, when the user inserts rows and copies and pastes stuff around, the named range shouldn't change - it'll stick with the original cell. Then, when I close the spreadsheet, I scan down the column with the named ranges, checking to make sure that every row has a range name (if that's possible). If I find a cell without a name, I add one. Must go and play... Thanks Steve "Peter T" <peter_t@discussions wrote in message ... Afraid my suggestion about storing values etc doesn't cater for possibility of entire row being copied ):- Peter T "Peter T" <peter_t@discussions wrote in message ... Hi Steve, To cover all the scenarios you mention might be impractical, but for what purpose/usage do you need unique row identifiers, in addition to the fact you can always read row numbers. Maybe you could define worksheet level named ranges, these would move as you insert rows though would end up with meaningless names for deleted ranges (#REF). Would you want 10k names though (but much better than 10k comments). If you were "allowed" to insert an extra column (hidden perhaps) populate with row numbers as values. Store the highest number somewhere (a cell or named formula). To cater for row inserts & new rows at the end, in selection and/or change events check the identifier cell has a value. If not increment the stored highest number and place same as the new identifier. But with the limitations imposed by your client you are a bit strapped! Regards, Peter T "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#11
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
Not exactly what you described, but near enough: You have a sheet with column ID, where you need unique identificators for every row. Add a sheet ID, with columns FreeNr, Nr, Used, ID (headings in row 1) ID!A2=IF($C2=TRUE,"",COUNTIF($C$2:$C2,FALSE)) ID!B2=ROW()-1 ID!C2=COUNTIF($B2,Sheet1!$A:$A)0 ID!D2=IF(ISERROR(INDEX($B:$B,MATCH(ROW()-1,$A:$A,0),)),"",TEXT(INDEX($B:$B,MATCH(ROW()-1,$A:$A,0),),"00000")) Copy cells A2:D2 down for some reasonable amount of rows (you can expand this table later, whenever you run out of free ID's) Define a named range ID=OFFSET(ID!$D$1,1,,COUNTIF(ID!$D:$D,""&"""")-1,1) On your working sheet, select a range in ID column, and apply Data ValidationList with source =ID Whenever you add an entry, you are allowed only to enter (manually or from dropdown) unused ID's . NB! You can copy a non-unique value into ID column although (p.e. when coping rows). You can use conditional formatting to indicate such non-unicue ID values, p.e. through different font color - so you can change them. -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#12
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
They won't let me add new sheets or columns. To be fair to them, this
spreadsheet has grown out of all control (it's over 50Mb now) and has been messed with by a lot of people.Because of this, there are strict controls on what you can do to it and you need strong justifications if you're to add new sheets or columns. Thanks Steve "Arvi Laanemets" wrote in message ... Hi Not exactly what you described, but near enough: You have a sheet with column ID, where you need unique identificators for every row. Add a sheet ID, with columns FreeNr, Nr, Used, ID (headings in row 1) ID!A2=IF($C2=TRUE,"",COUNTIF($C$2:$C2,FALSE)) ID!B2=ROW()-1 ID!C2=COUNTIF($B2,Sheet1!$A:$A)0 ID!D2=IF(ISERROR(INDEX($B:$B,MATCH(ROW()-1,$A:$A,0),)),"",TEXT(INDEX($B:$B,MATCH(ROW()-1,$A:$A,0),),"00000")) Copy cells A2:D2 down for some reasonable amount of rows (you can expand this table later, whenever you run out of free ID's) Define a named range ID=OFFSET(ID!$D$1,1,,COUNTIF(ID!$D:$D,""&"""")-1,1) On your working sheet, select a range in ID column, and apply Data ValidationList with source =ID Whenever you add an entry, you are allowed only to enter (manually or from dropdown) unused ID's . NB! You can copy a non-unique value into ID column although (p.e. when coping rows). You can use conditional formatting to indicate such non-unicue ID values, p.e. through different font color - so you can change them. -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) "Steve Barnett" wrote in message ... I have a spreadsheet (Excel 2000) that contains around 10,000 rows. I now need to be able to identify each row via a unique identifier, but am having trouble working out what to do when new rows are added or when existing rows are copied and paste. New rows and copied rows should get new unique identifiers, but I can see no way of doing this. Does anyone have any suggestions? There is nothing unique about the data that I can hang on to and the "SheetChanged" event does not fire for inserted rows in Excel 2000. This spreadsheet is owned by one of our clients, so I can't add new worksheets or columns to the existing workbook - I can just add cell comments (unless you have a better suggestion). Can anyone help? Thanks Steve |
#13
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi
Then it's past time to redesign it! P.e. when there are tables, which are altered occasionally only, and which at same time contain a lot of formulas, then you can split them into separate workbook. In working workbook, you keep replicas of them, which are generated through ODBC queries, and are refreshed on open - as result those replicas contain only values, what may improve perfomance a lot. "Steve Barnett" wrote in message ... They won't let me add new sheets or columns. To be fair to them, this You need to add a single sheet with 4 columns of formulas. On your working sheet, you have the ID column, or you have to add ti anyway. -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) |
#14
![]()
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I fully agree, it should be scrapped and rewritten as a proper database app,
which is what it always should have been. Unfortunately, it started life as a couple of hundred rows and just grew. As with all such systems, no one really noticed until it started getting painful to add new entries and it was too late by then, as they were committed. My latest solution required named ranges on every row - I'm just not sure yet whether I can take a cell address and find the named range that contains it. Steve "Arvi Laanemets" wrote in message ... Hi Then it's past time to redesign it! P.e. when there are tables, which are altered occasionally only, and which at same time contain a lot of formulas, then you can split them into separate workbook. In working workbook, you keep replicas of them, which are generated through ODBC queries, and are refreshed on open - as result those replicas contain only values, what may improve perfomance a lot. "Steve Barnett" wrote in message ... They won't let me add new sheets or columns. To be fair to them, this You need to add a single sheet with 4 columns of formulas. On your working sheet, you have the ID column, or you have to add ti anyway. -- Arvi Laanemets ( My real mail address: arvi.laanemets<attarkon.ee ) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need to automate unique identifier | Excel Worksheet Functions | |||
Unique identifier | Excel Discussion (Misc queries) | |||
Unique identifier | Excel Worksheet Functions | |||
unique identifier for invoices | Excel Worksheet Functions | |||
Unique Identifier? | Excel Programming |