Home » excel » Excel – how to NOT a formula?

# Excel – how to NOT a formula?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m testing an Excel formula that returns Boolean (True or False)

This one works fine:

`=OR(ISBLANK(B2),AND(LEN(B2)=12,ISNUMBER(SUMPRODUCT(FIND(MID(B2,ROW(INDIRECT("1:12")),1),"0123456789abcdefABCDEF")))))`

Now I want to reverse the result. So I wrap a `NOT()` around it. But Excel won’t take it. Why? Thanks!

`=NOT(OR(ISBLANK(B2),AND(LEN(B2)=12,ISNUMBER(SUMPRODUCT(FIND(MID(B2,ROW(INDIRECT("1:12")),1),"0123456789abcdefABCDEF"))))))`

How to&Answers:

To validate a MAC address (or find non-valid ones) split the address into 2 hexadecimals of 6 each and attempt a HEX2DEC conversion.

``````'validate
=OR(LEN(B2)=0, AND(LEN(B2)=12, IFERROR(HEX2DEC(LEFT(B2, 6))*HEX2DEC(RIGHT(B2, 6)), FALSE)))
=OR(LEN(B2)=0, AND(LEN(B2)=12, ISNUMBER(SUMPRODUCT(HEX2DEC(LEFT(B2, 6)), HEX2DEC(RIGHT(B2, 6))))))
'find non-valid
=NOT(OR(LEN(B2)=0, AND(LEN(B2)=12, IFERROR(HEX2DEC(LEFT(B2, 6))*HEX2DEC(RIGHT(B2, 6)), FALSE))))
=NOT(OR(LEN(B2)=0, AND(LEN(B2)=12, ISNUMBER(SUMPRODUCT(HEX2DEC(LEFT(B2, 6)), HEX2DEC(RIGHT(B2, 6)))))))
``````

This is essentially what your original formula does but with less calculation load. tbh, I’m not sure why your NOT wrapper didn’t work; it did for me.