A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Try this:
=IF(AND(MOD(A1,3)=0,MOD(A1,5)=0),"FizzBuzz",IF(MOD(A1,3)=0,"Fizz",IF(MOD(A1,5)=0,"Buzz",A1)))
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
First off here is my code:
=IF(MOD(A1,3)=0,"Fizz",IF(MOD(A1,5)=0,"Buzz",IF(AND(MOD(A1,3)=0,MOD(A1,5)=0),"FizzBuzz",A1)))
What I want to happen is if the number in A1 is a multiple of 3 return Fizz, if a multiple of 5 return Buzz, and if a multiple of both 3 and 5 return FizzBuzz. Otherwise return the number in A1. All is well and good until 15, which should return FizzBuzz. Instead I get Fizz. So it's taking the first true condition and stopping, which I understand is what it is supposed to do. So I feel like I am missing an or maybe? somewhere. I just don't know where to put it. Am at least on the right track?
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
Try this:
=IF(AND(MOD(A1,3)=0,MOD(A1,5)=0),"FizzBuzz",IF(MOD(A1,3)=0,"Fizz",IF(MOD(A1,5)=0,"Buzz",A1)))
Perfect Thanks!