Here are a couple of implementations of the Sieve of Eratosthenes:
Based on primes 2 and 3
Code:
=PRODUCT(--({2,3}*INT(A1/({2,3}))<>A1))*PRODUCT(--(MOD((A1/({1,5}+2*3*ROW(OFFSET(A$1,,,SQRT(A1)/2/3)))),1)<>0))=1
Based on primes 2, 3 and 5
Code:
=PRODUCT(--({2,3,5}*INT(A1/({2,3,5}))<>A1))*PRODUCT(--(MOD((A1/({1,7,11,13,17,19,23,29}+2*3*5*ROW(OFFSET(A$1,,,SQRT(A1)/2/3/5)))),1)<>0))=1
By extending this to include primes 2, 3, 5, 7 and 11 then Excel can verify that 999,999,999,999,989 is prime, and therefore the largest that it can represent. The formula is pretty long (1,650 characters) because it needs to include the list of primes less that 2*3*5*7*11=2,310.
Watch out for the 2-dimensional array formula here - I don't think it's been used in the Challenges before and could be useful in the future