Page 1 of 1

### How to create conditional logarithms in cells?

Posted: Mon Dec 17, 2007 4:05 pm
OS: Linux (gentoo, specifically)

Okay, I'm putting a spreadsheet together for a specifically musical application, and what I want to do is this:

I have a hypothetical value, that corresponds to a pitch. I want to find out what the closest octave of this value is to the standard pitch for tuning, which is 440 herz. To get octaves, we multiply or divide by 2. For example, say my value is 60 (maybe because I want to be in tune with electric current in the US, which runs at 60Hz). To get the closest value to 440Hz, I keep multiplying by 2, until I get 480Hz. I know that whatever value I seek will be between about 311Hz and 622Hz, as each of these are precicely one half-octave below and above 440 Herz, respectively.

In other words, I want to find x such that x=F*2^n, and 311=<x=<622. F is my starting value, and n is any integer. I want to output the value of x into a cell.

I suspect that it all has something to do with logarithms, perhaps the MROUND function, or maybe the IF function. Can anybody offer some advice?

Thanks,

EE

### Re: How to create conditional logarithms in cells?

Posted: Mon Dec 17, 2007 7:22 pm
See if this works:
Code: Select all   Expand viewCollapse view
`x: =F/2^ROUND(LOG(F/440;2);0)`