Quantcast
Channel: Active questions tagged worksheet-function - Super User
Viewing all articles
Browse latest Browse all 1191

Check that list contains all of alphabet exactly once [closed]

$
0
0

I have the following problem:

A range (should be) arranged by a unique ID assigned sequentially,call them "ID A"," ID B",... (assume there are less than 26 entries sorunning out of IDs isn't a problem). I wish to check that the rangedoes indeed have valid IDs.

That is, if the cells are:

ID A, .... (the .... are more data, we only need to check the IDs),

ID B, ....

ID C, ....

Formula should return TRUE (or other OK value)

The formula should detect duplicates: If the cells are

ID A,

ID B,

ID C,

ID C,

ID D,

Formula should return FALSE (or bad value), since ID C is not unique.

Finally, the formula should detect "skips")

ID A

ID B

ID C

ID E

ID F

ID G

should return FALSE since "D" is skipped.

ANy help is appreciated!

Edit: The only idea that occurs to me would be to brute force it... count the number of cells in the range and then do a series of countif statements:

if #ID A != 1, error,if #ID B != 1, error,... up to the number of cells in the range.

I.e. if there are 5 cells, we expect ID A, ID B,ID C, ID D, ID E, to be present exactly once, so we simply do a linear count.

Surely there must be a more compact way of doing this (and scalable, assuming we have hundreds of sequential IDs A,...,Z,AA,...,ZZ,....


Viewing all articles
Browse latest Browse all 1191

Trending Articles