bruce2757
bruce2757

Reputation: 21

Error in formula when comparing two separate formulas

I have the first and second formula to make sure the number I get is the same, which it is (32). The bottom formula however displays false and I have no clue why. (JA2 has a formula which outputs "32(22)"). Can anyone help me understand how they are not equal?

=LEFT(JA2,2)
=ISOWEEKNUM(TODAY())
=LEFT(JA2,2)=ISOWEEKNUM(TODAY())

Upvotes: 0

Views: 34

Answers (1)

Scott Craner
Scott Craner

Reputation: 152505

LEFT returns a string ISOWEEKNUM returns a number. A string will not equal a number. Turn the string to a number:

=--LEFT(JA2,2)=ISOWEEKNUM(TODAY())

The -- or double unary is akin to -1*-1* which will change the string to a number if possible or return an error. So you may want to use IFERROR to deal with that possibility:

=IFERROR(--LEFT(JA2,2),60)=ISOWEEKNUM(TODAY())

Now if the Left is a string that cannot be converted to a number the formula will return 60 and since there can only be a max of 53 weeks it will return FALSE

Upvotes: 1

Related Questions