Value of Square (x, y) in excel?

Hello!

Excel is a really simple and powerful calculation program for a lot of calculations. For example a lot of number series like the Fibonacci series can be easily programmed in excel, you only have to refere to the square before and the square before that. But what about when they become a little bit more complex? Like if you are programming a number series and you want square with index n to be dependent on square with index n/2 if n is even, (n-1)/2 if n is odd?

Thanks