Jenkins
asked on
Check if item is in a list in an Excel macro
Wondering if there is way using an Excel macro to check if an item is in a list instead of using IF THEN ELSE statements. As an example, let's say of the 50 United States, if a particular state is a blue state, do something; if a particular state is a red state, do something else. I'm trying to avoid coding something like what I have below, which is tedious and probably also takes a lot longer to process (especially if dealing with a large number of items that need to be checked) than some other method:
If state = 'CA' or 'NY' or 'NJ' or 'NH' or ......etc, etc then
do something
elseif state = 'TX' or 'SC' or 'GA' or.... etc etc then
do something
else <------ it's possible in the source data that a particular item, for some reason, is not a state at all
do something
If state = 'CA' or 'NY' or 'NJ' or 'NH' or ......etc, etc then
do something
elseif state = 'TX' or 'SC' or 'GA' or.... etc etc then
do something
else <------ it's possible in the source data that a particular item, for some reason, is not a state at all
do something
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.