Is this a question on Excel or Javascript ?

Regards,

Felix

Solved

Posted on 2007-10-17

Hi All,

Got a mind boggler,

I'm trying to build a function that returns x when it's fed with z. Here's the formula:

180 = (((x-1)/x)/((1/z)*((x-1)/x)*(x*(19/(x*(x-1))))))

Anyone got a clue? is it even possible?

Many thanks

Jon

Got a mind boggler,

I'm trying to build a function that returns x when it's fed with z. Here's the formula:

180 = (((x-1)/x)/((1/z)*((x-1)/x

Anyone got a clue? is it even possible?

Many thanks

Jon

16 Comments

<html>

<head>

<title>Untitled</title>

<script>

function getX(z){

for(x=0; x<1000; x++){

if(180 == (((x-1)/x)/((1/z)*((x-1)/x

return 'x = ' + x;

break;

}

}

return 'possible value not found in range.'

}

</script>

</head>

<body>

<form>

Value for Z:<input type="text" id="z"/>

<input type="button" value="Get X" onclick="alert(getX(docume

</form>

</body>

</html>

Now in D24 put the formula "= (((C24-1)/C24)/((1/B24)*((

Don't worry if the above formula gives an error result like "#Div/0"

Feed in the input value for Z in B24, and then go to Tools -> Goal Seek

Set Cell = D24 (As you have stored the result in D24)

To Value = 180 (as this is your expected result for the formula)

By Changing Cell = C24 (As this cell contains the value of X which you are searching for.

If you have your values in other cells, change the cell addresses accordingly.

<form>

Value for Z:<input type="text" NAME="z"/>

<input type="button" value="Get X" onclick="alert(getX(this.f

</form>

Felix: ultimately javascript, but if you can get it into excel i'm sure i could port it.

mplungian: "x=.........z.............

cezarF: that's pretty much how i've been calculating X already using trial and error in excel.

I calculated some sample values using the formula above hoping to clarify things further:

if z = 200 then x = 18.1

if z = 400 then x = 9.55

if z = 600 then x = 6.7

if z = 800 then x = 5.275

However logic says to me that if i have a formula i can work backward from, then it must be possible to re-arrange the formula so i can work forwards to get X from just Z.

ps. z is always an integer and can be between 1 and 2000.

if (!Number.toFixed) {

Number.prototype.toFixed=f

var temp=this;

temp=Math.round(temp*Math.

return temp;

};

}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<title>Untitled</title>

<script>

function getX(z){

var n = 0.0

for(y=1.0; y<100.0; y+=0.001){

x = y.toFixed(3);

n = (((x-1)/x)/((1/z)*((x-1)/x

n.toFixed(3)

window.status = 'x = ' + x + '; n = ' + n

if(180 == n){

return 'x = ' + x;

break;

}

}

return 'possible value not found in range.'

}

</script>

</head>

<body>

<form>

Value for Z:<input type="text" name="z"/>

<input type="button" value="Get X" onclick="alert(getX(this.f

</form>

</body>

</html>

x = (3420/z) + 1

seems a better version, if correct no?

function getVal(z) {

return (3420/z) + 1;

}

(no points to me)

i've got 8 sheets of paper covered in algebra trying to simplify it, i think i was getting there :)

now all i need is the X on the left on it's own and i can get it into javascript!

This is absolutely brilliant, thanks guys.

Is Everyone ok with the following split?

Felix (340) Accepted

gnoon (80)

mplungjan:(40)

cezarF (40)

Title | # Comments | Views | Activity |
---|---|---|---|

recent documents in word and Excel | 5 | 29 | |

VBA Overflow problem when filtering | 14 | 37 | |

Workbooks.Open File already exists in this location | 4 | 13 | |

VBA Macro to clean up report | 4 | 5 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**16** Experts available now in Live!