Name Change that does not change class

edscollects

New Member
Joined
Feb 8, 2023
Messages
36
Office Version
  1. 2021
Platform
  1. Windows
I have this document that I am inputting information on the Input tab. I am then performing different functions on each of the other tabs. On the input tab there are schools in column B and class names by year in most of the other columns. For each of the schools on the conf history I list each unique class name and the years in that class. In the Conf Output tab I list each class name and each school and year that has participated in that class. There is an occasion when the class name changes, much in the same way a woman changes their last name when they get married. I have these changes listed with the year on the Name Change tab. I need the Conf History and Conf Output to both not count those name changes as unique strings. An perfect example of this is in 2019 03IIAC changed its class name to 03AMRIV. Currently on those Conf History and Conf Output is showing both as different classes. I would like it to show only the newest class name and include all the former class name years and schools. I would greatly appreciate any help.


NCAA 5-1-23.xlsm
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I seem that you build ConfOutput and ConfHistory starting from sheet Input.
So my suggestion is that you create a "temporary Input" where old names have been replaced by newo ones, and then you build your outputs starting from this temporary Input.

The folllowing macro
1) duplicates sheet Input (that don't get modified
2) replaces the old names according the list from sheet NameChange
3) renames this new sheet as InputZc

VBA Code:
Sub NewInput()
Dim I As Long
Dim CLog As Range
'
On Error Resume Next
Application.DisplayAlerts = False
    Sheets("InputZc").Delete
Application.DisplayAlerts = True
On Error GoTo 0
'Duplicate Input
Sheets("Input").Copy after:=Sheets("Input")
Set CLog = Sheets("Name Change").Range("A1").CurrentRegion
Set CLog = Sheets("Foglio5").Range("A1").CurrentRegion
'Replace Changed
For I = 2 To CLog.Rows.count
    Cells.Replace what:=CLog.Cells(I, 2), replacement:=CLog.Cells(I, 1), lookat:=xlWhole, MatchCase:=False
Next I
ActiveSheet.Name = "InputZc"
End Sub
So you may rework your macros that generate the output:
a) on top of them insert Call NewInput, to create this new sheet
b) modify your code to refer to InputZc rather than to Input (I think you have only to modify in Sub SummariseCodes_WithColours the line Set shtInput = Worksheets("Input"), but you know your code better than me)
If you wish you might add Sheets("InputZc").Delete before the end of your macro, to remove the added sheet

Try...
 
Upvote 0
I used that line for testing and forgot to delete it before publishing the message :mad:
Please delete it
 
Upvote 0
Thank you it works. It takes some time to run is there any way to speed it up? Or is that not possible.
 
Upvote 0
I just ran the code and I noticed that on the InputZc sheet it randomly is changing the number prefix. Is there a reason this would happen? Take a look.NCAA 5-1-23.xlsm
 
Upvote 0
Please give me some example, I don't know what to search
 
Upvote 0
Ok if you go to the InputZc Rows AE1132 is just one example. Any color that is the purple color should have a 05 prefix and if you look quite a few randomly changed to a 04 prefix.
 
Upvote 0
Probably I misunderstood the meaning of the table in NameChange:
byEDSCOLLECTS_C30603_ NCAA 5-1-23.xlsm
ABC
1NewOldYear
203C2CAC03CAPAC2022
303UNEC03NEAC2021
404CONTAC05AII2021
504APPAC05APPAC2021
604CCAC05CCAC2021
704CALPAC05CALPAC2021
804CASCC05CASCC2021
904CCAC05CCAC2021
1004CROSL05CROSL2021
1104GPAC05GPAC2021
1204KCAC05KCAC2021
1304NSAA05NSAA2021
1404RIVSTC05RIVSTC2021
1504SUNCON05SUNCON2021
1604WHAC05WHAC2021
1705AII04AII2020
1803AMRIV03IIAC2019
1905CROSL05MCCC2013
2005CCAC04CCAC2013
2101AMAC01BIGEC2014
2205RIVSTC05KIAC2016
Name Change

My macro replace any "Old" listed in column B with its "New" in column A; thus any "05APPAC" became "04APPAC"

If this is wrong how that table should be interpreted??
 
Upvote 0
The table in name change is when a class changes names. So on the input tab every column to the right of Column B is a year. Now on the name change tab it shows when a class changes names and the year it changes. So for instance, in 2021 03NEAC changed to 03UNEC. This is so that in the year 2020 the names 03NEAC and in 2021 03UNEC is not a change in classification but the classification changes names. To restate a possibly simpler way. If this was a woman, 03NEAC was married in 2021 and the married name thereafter is 03UNEC.
 
Upvote 0

Forum statistics

Threads
1,215,227
Messages
6,123,739
Members
449,116
Latest member
alexlomt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top