Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If my data looks like the following -
StudentID School Year CourseID CourseName 724260 2000-2001 8881 PE 724260 2000-2001 8881 PE 697660 2001-2002 8891 PE 697660 2001-2002 8891 PE 697660 2001-2002 8891 PE I would like to make each record unique by addling a number to the CourseID so that I'd end up with: StudentID School Year CourseID CourseName 724260 2000-2001 8881-1 PE 724260 2000-2001 8881-2 PE 697660 2001-2002 8891-1 PE 697660 2001-2002 8891-2 PE 697660 2001-2002 8891-3 PE How can I do this? Thank you, Sheldon Potolsky |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Fri, 23 Jan 2009 11:26:18 -0800 (PST), Sheldon Potolsky
wrote: If my data looks like the following - StudentID School Year CourseID CourseName 724260 2000-2001 8881 PE 724260 2000-2001 8881 PE 697660 2001-2002 8891 PE 697660 2001-2002 8891 PE 697660 2001-2002 8891 PE I would like to make each record unique by addling a number to the CourseID so that I'd end up with: StudentID School Year CourseID CourseName 724260 2000-2001 8881-1 PE 724260 2000-2001 8881-2 PE 697660 2001-2002 8891-1 PE 697660 2001-2002 8891-2 PE 697660 2001-2002 8891-3 PE How can I do this? Thank you, Sheldon Potolsky If your data is in columns A thru D, you can get a column with unique Course ID in column E by this formula in cell E2: =C2&"-"&(SUMPRODUCT((C$1:C1=C2)*(A$1:A1=A2)*(B$1:B1=B2)* (D$1:D1=D2))+1) Copy down as far as you have data. The first parenthesis (C1$:C1=C2) should always be there. The other parenthesis you can add if needed (your example does not show if different student ID' or different School years can have the same Course ID). Hope this helps / Lars-Åke |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
Why not just =C2&"-"&COUNTIF(C$2:C2,C2) and copy down? Regards, Bernd |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Fri, 23 Jan 2009 12:39:14 -0800 (PST), Bernd P
wrote: Hello, Why not just =C2&"-"&COUNTIF(C$2:C2,C2) and copy down? Regards, Bernd From the example given it is not clear if there could be the same course ID for different student ID's (or different school years) and, if so, the unique course ID should be "globally unique" or just unique for each student ID. Lars-Åke |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Lars-Åke,
Ok, you are right if local uniqueness is required. But then I would suggest to use =C2&"-"&SUMPRODUCT((C$2:C2=C2)*(A$2:A2=A2)*(B$2:B2=B2)*( D$2:D2=D2)) or even =C2&"-"&SUMPRODUCT((C$2:C2=C2)*(A$2:A2=A2)*(B$2:B2=B 2)) Regards, Bernd |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Sat, 24 Jan 2009 03:38:27 -0800 (PST), Bernd P
wrote: Hello Lars-Åke, Ok, you are right if local uniqueness is required. But then I would suggest to use =C2&"-"&SUMPRODUCT((C$2:C2=C2)*(A$2:A2=A2)*(B$2:B2=B2)*( D$2:D2=D2)) or even =C2&"-"&SUMPRODUCT((C$2:C2=C2)*(A$2:A2=A2)*(B$2:B2=B 2)) Regards, Bernd Yes, that is a bit simpler :-) / Lars-Åke |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding unique names--then converting those names to unique number | Excel Discussion (Misc queries) | |||
Appending / Concatenating by Client Number | Excel Programming | |||
Date column changed to number format while concatenating | Excel Discussion (Misc queries) | |||
concatenating a number plus a formatted number | Excel Programming | |||
concatenating and formatting area code and phone number columns | Excel Worksheet Functions |