VBA – Function in Excel to check prime numbers

Prime numbers are numbers, divisible by themselves:


In the current example I simply made an Excel VBA function telling us whether a number is prime or not. It works as a charm šŸ™‚ CheckĀ the primeĀ numbers between 1 andĀ 100:

VBA Function

Check how the formula works in Excel:

Excel Function

So, this is how it works. And finally, here comes the code:

Enjoy it! šŸ™‚

Tagged with: , , , ,