Excel challenge – FizzBuzz
The rules are simple:
- Count up from zero.
- If the current number is a multiple of 3, say “Fizz” instead of the number
- If it’s a multiple of 5, say “Buzz”
- If it’s a multiple of both 3 and 5 say, “Fizzbuzz”
Write a formula for column C that plays the game of Fizzbuzz on the number sequence in column B.
*A multiple is a number that may be divided by another a certain number of times without a remainder
Post your solution in the comments below! 🙂
First attempt, with IF-statements:
=IF(AND(MOD(B3;3)=0;MOD(B3;5)=0);”Fizzbuzz”;IF(MOD(B3;3)=0;”Fizz”;IF(MOD(B3;5)=0;”Buzz”;B3)))
Out of curiosity without IF-statements (and by chance a fascinating discovery (for me) of the mathematical approach – google “Euler’s fizzbuzz”)
=SWITCH(MOD(B3^4;15);1;B3;6;”Fizz”;10;”Buzz”;0;”Fizzbuzz”)