Search

All articles with 'SQRT()' Tag

Formula Forensics 024. Is this number a Prime Number ?

Published on Jul 12, 2012 in Formula Forensics, Huis, Posts by Hui

Is my number a Prime Number?
What is a Prime Number?

Today in Formula Forensics we answer both questions.

Continue »

Array formula to check if a number is prime [just for fun]

Published on May 29, 2009 in Learn Excel

I am math-geek-wannabe, if there ever is such a category. During my 3rd year of graduation I went and purchased the volume 2 of Donald Knuth’s Art of Computer Programming and thus began my love with all things random and prime. I never really became the math-geek I always wanted to, instead I became an insurance expert with tons of passion for data and visualization. But when I get a chance to poke with randomness or numbers, I always lap it up with joy. And that brings us to an interesting array formula trick to check if a number is prime or not.

(assuming the number is in the cell B2) type the below formula and

=IF(MIN(MOD(\$B\$5,ROW(INDIRECT(“2:”&INT(SQRT(\$B\$5))))))=0,”not prime”,”prime”)

hit ctrl+shift+enter and bingo, it tells you if the number is prime or not. Read on to find how it works

Continue »

Get FREE Excel & Power-BI Newsletter

One email per week with Excel and Power BI goodness. Join 100,000+ others and get it free.