I am already using the Auto Number column, but I want to generate a unique [Program Code]@row for each new program added to a sheet, starting with 5,000. However, I don't want to assign a Program Code to a program added to the sheet, if the [Program Name}@row is a duplicate of an already existing program.
Program Code | Program Name
5000 | Psychology
5001 | Sociology
5002 | Theology
none | Sociology
New programs are added to the bottom of the list (when the row is copied from another sheet). No Program existed at first, so the first one (Psychology) was assigned 5000 (as a result of the formula). Then, each new program added was 500x + 1. However, when Sociology was submitted again, no Program Code is assigned because this was a duplicate submission.
I tried using the COUNTIFS to check for duplicate program names, then MAX to determine highest program code that existed. But I was getting #CIRCULAR and then #BLOCKED errors, even when I tried using a Helper column:
[H-Program Code] Helper column formula:
=COUNTIFS([Program Name]:[Program Name], [Program Name]@row)
[Program Code] column formula:
=IF([H-Program Code]@row > 1, "", IF(COUNT([Program Code]:[Program Code]) = 0, 5000, MAX([Program Code]:[Program Code]) + 1))
Thanks in advance!