Reputation: 143
I have a drop-down list with a few different Banks. Each bank has different criteria for their account numbers for example, BANK A has between 10-15 digits in their account numbers, BANK B has exactly 12 digits in their account numbers etc.
I am a bit unsure where to begin but I assume it can be done by combining an IF statement and LEN, so basically IF C2 (C2 being the drop down list with all the banks) equals "BANK A" then the text length criteria would be between 10 and 15, else if C2 equals "BANK B" then the text length criteria would be 12.
If less than 10 digits is entered or more than 15 digits is entered when "BANK A" is chosen, then an error message shows, and likewise, if text length != 12 when "BANK B" is chosen, then an error message shows.
Is something like this possible in Excel? Sorry i'm not really good at Excel apart from creating simple spreadsheets. Searched Google and here and have found nothing.
Upvotes: 0
Views: 80
Reputation: 152450
Create a lookup table:
And use the follow that references that table:
=AND(LEN(B2)<=VLOOKUP(A2,F:H,3,FALSE),LEN(B2)>=VLOOKUP(A2,F:G,2,FALSE))
Upvotes: 3