I have developed a formula using approximately 7 nested "IF" statements, each with the functions "CONCATENATE" "VLOOKUP," "LEFT," "RIGHT," "MID." However I was wondering if there were a shorter, simpler, more elegant approach. I don't know if it is appropriate to use this forum for help to suggest a better way to approach a problem that is effectively solved, but I was hoping someone would tackle this issue.
Application: collect water samples around the plant, and code them with a descriptive code. The code is an alpha-numeric code containing either 16 characters (including hyphens separating subcodes) or 18 characters. Example of a 16-character code: PW-021307-01-PLP; example of an 18-character code: MW-PJ020120-01-GRV.
Explanation: Prefix (PW/MW) represents the water system. PJ020120 represents the batch number of the product using the water; 021417 represents the date the sample was collected; PLP / GRV represent the source from which the sample was collected. Results of tests for all water systems are entered into a log, recording the date, sample code, and results of the tests (a numeric value). There are linked spreadsheets that capture the data from the main log specific to the year, water system and source. A statistical analysis is performed on this data to generate trending numbers.
The problem: Only certain 3-letter suffixes are appropriate for the specific water system. For example "GRV" is exclusive to MW; "PLP" is exclusive to PW. There are approximately 6 to 8 suffixes for each water system that are exclusive. The VLOOKUP function gathers the text description from the 3-character code. I want to develop a code on the main page to generate an error message if the analyst enters the wrong code. For example if the analyst enters the code "PW-021417-01-GRV" an error message should appear in the column notifying the analyst to correct the entry. If a wrong code is entered, the individual spreadsheets cannot capture the data.
There are 3 water systems each with approximately 6 unique sources. See attached for the formulas. There are approximately 1000 rows in the main page each with a sample code and data.
Bookmarks