3

In my Worksheet I have a Table and want to define Data validation for a column that contained the date, as bellow:

=S2M(B2)<>"Error"

In above, S2M() is a user defined function for converting date from Persian date to Gregorian date, because checking input date is right.

But excel is not letting me use user defined functions in Custom Data validation.

This error shows: A named range you specified cannot be found.

Please note that I was using bellow code in Custom Data validation and that works, right.

=AND(LEN(B2)=10;ISNUMBER(IFERROR(VALUE(MATCH(VALUE(MID(B2;1;4));INDIRECT("intTable[Year]");0)&MATCH(MID(B2;6;2);INDIRECT("intTable[Mounth]");0)&MATCH(MID(B2;9;2);INDIRECT("intTable[Day]");0));FALSE)))

Explain is a Persian date example: 1396/05/25

Thanks.

4
  • 1
    I think you can't, see this post bellow: superuser.com/questions/797053/… Commented Aug 16, 2017 at 9:51
  • I don't know, maybe the guy who down-vote think you did not make enough researches ... Commented Aug 16, 2017 at 9:57
  • Upvoted as the question is both reasonable and clear to me. :) Commented Aug 16, 2017 at 10:02
  • Above answer not cover my question. That answer is: The user-defined function must return a Range not an array of value. and in above, my user defined function returns not an array of value. Commented Aug 16, 2017 at 10:02

1 Answer 1

2

You can do that. Select B2, or whichever cell in row 2 you want the validation to apply to. Now define a name called, say, IsValid, using:

=S2M(B2)<>"Error"

Now in the data validation box, all you need to enter is:

=IsValid

in the source box and make sure to uncheck the Ignore Blank option.

Sign up to request clarification or add additional context in comments.

17 Comments

Problem. I want apply the validation for the column of a Table. But when using above, IsValid "Refer to" code, not extend from B1 to B2 and ... for each column cell of respective Table. This way works only for single cell, that defined in S2M(B2)<>"Error"
No, if you entered it as specified, it will adjust for each row.
Greatly thanks. That would be awesome. May I remove above comment, or its better to stay?
Why Ignore blank should be uncheck? That is an important point. Whats the reason of unchecking that, related to this?
I don't mind either way. If you don't uncheck it, it won't work. I think it's a bug.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.