In addition to the question I posted previously, (Change text length based on drop down option selected), I have another scenario where a Bank's account numbers (BANK C) are either 10 or 15 digits long. The answer to my previous question facilitated changing the text length to a range (between 10 and 15 digits) and changing the text length to exactly 12 digits, by creating a lookup table and defining the min and max values.
I was told that a different approach would be needed to change the text length to either one of two values (meaning either 10 or 15 digits), but nothing I've tried so far has worked.
As shown in the last question:
I am using the following table:
I am using the following formula in my Data Validation:
=AND(LEN(B2)<=VLOOKUP(A2,F:H,3,FALSE),LEN(B2)>=VLOOKUP(A2,F:G,2,FALSE))
VLOOKUP will only return the first line and I need it find multiple so I can test against those.
How can I go about getting this to work, while still allowing the other two ways to work?
Maybe slightly different approach as shown below. Validation rule formula seems working to me:
=NOT(ISERROR(MATCH(LEN(C3),OFFSET($G$4:$G$9,,MATCH(B3,$G$3:$I$3,0)-1),0)))
We are just checking if we can find length in specific column in the table. Possible values means all possible lengths. You can also build your table horizontally, but this will require some formula adjustments. If you want, you can either expand Range G4:G9 and G3:I3 or change it to named range, or try referencing to column and header of table - these solutions will make our validation formula flexible (when you add item to list, formula will change automatically). I am pretty sure that it is also possible to simplify that formula. I'm sorry for cutting row numbers in the screenshot.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加