Fractional Ratio

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the fields Apples and Oranges. I would like to show the ratio of
Apples to Oranges. If there are 4 Apples and 6 Oranges I would like to have
another field that would contain the ratio 2:3 (Apples:Oranges). Is this
possible? Thanks

Qaspec
 
Create a table name CountNUM with a field named CountNUM with numbers 1
through 99.
SELECT Fruit.Apples, Fruit.Oranges, [Apples]/[CountNUM] & " : " &
[Oranges]/[CountNUM] AS Ratio
FROM Fruit, CountNumber
WHERE (((CountNumber.CountNUM)>1) AND
(([Apples]/[CountNUM])=Int([Apples]/[CountNUM])) AND
(([Oranges]/[CountNUM])=Int([Oranges]/[CountNUM])))
ORDER BY Fruit.Apples, Fruit.Oranges;


If the two numbers are at the lowest ratio value they will not be displayed.
If you remove the criteria of >1 then the ratios listed will include the
orignal also.
 
Thanks that works great but how can i get it to list only the most reduced
ratio even if the ratio could not be reduced? Ex 1:3 might be the original
but i would still like that listed as the ratio while 6:9 can be reduced to
1:3 and I would like that to be listed as the ratio. Right now i get both iif
i take out the >1. I tried to change the query to add the Totals field and
add MIN to exp1 and exp2 but i get an error message. Thanks for the help.

Qaspec

KARL DEWEY said:
Create a table name CountNUM with a field named CountNUM with numbers 1
through 99.
SELECT Fruit.Apples, Fruit.Oranges, [Apples]/[CountNUM] & " : " &
[Oranges]/[CountNUM] AS Ratio
FROM Fruit, CountNumber
WHERE (((CountNumber.CountNUM)>1) AND
(([Apples]/[CountNUM])=Int([Apples]/[CountNUM])) AND
(([Oranges]/[CountNUM])=Int([Oranges]/[CountNUM])))
ORDER BY Fruit.Apples, Fruit.Oranges;


If the two numbers are at the lowest ratio value they will not be displayed.
If you remove the criteria of >1 then the ratios listed will include the
orignal also.
--
KARL DEWEY
Build a little - Test a little


Qaspec said:
I have the fields Apples and Oranges. I would like to show the ratio of
Apples to Oranges. If there are 4 Apples and 6 Oranges I would like to have
another field that would contain the ratio 2:3 (Apples:Oranges). Is this
possible? Thanks

Qaspec
 
Change the >1 to >0 and it list all.
--
KARL DEWEY
Build a little - Test a little


Qaspec said:
Thanks that works great but how can i get it to list only the most reduced
ratio even if the ratio could not be reduced? Ex 1:3 might be the original
but i would still like that listed as the ratio while 6:9 can be reduced to
1:3 and I would like that to be listed as the ratio. Right now i get both iif
i take out the >1. I tried to change the query to add the Totals field and
add MIN to exp1 and exp2 but i get an error message. Thanks for the help.

Qaspec

KARL DEWEY said:
Create a table name CountNUM with a field named CountNUM with numbers 1
through 99.
SELECT Fruit.Apples, Fruit.Oranges, [Apples]/[CountNUM] & " : " &
[Oranges]/[CountNUM] AS Ratio
FROM Fruit, CountNumber
WHERE (((CountNumber.CountNUM)>1) AND
(([Apples]/[CountNUM])=Int([Apples]/[CountNUM])) AND
(([Oranges]/[CountNUM])=Int([Oranges]/[CountNUM])))
ORDER BY Fruit.Apples, Fruit.Oranges;


If the two numbers are at the lowest ratio value they will not be displayed.
If you remove the criteria of >1 then the ratios listed will include the
orignal also.
--
KARL DEWEY
Build a little - Test a little


Qaspec said:
I have the fields Apples and Oranges. I would like to show the ratio of
Apples to Oranges. If there are 4 Apples and 6 Oranges I would like to have
another field that would contain the ratio 2:3 (Apples:Oranges). Is this
possible? Thanks

Qaspec
 
Actually I don't want to list all...just the lowest possible ratio. What i
did was create another query using the original query as the source. I used
the totals field and set the Ratio field to MAX this always returns a the
lowest ration even if it could not be reduced in the first place. Thanks for
your help Karl. i couldn't have finished this project without the original
query you provided me with.

KARL DEWEY said:
Change the >1 to >0 and it list all.
--
KARL DEWEY
Build a little - Test a little


Qaspec said:
Thanks that works great but how can i get it to list only the most reduced
ratio even if the ratio could not be reduced? Ex 1:3 might be the original
but i would still like that listed as the ratio while 6:9 can be reduced to
1:3 and I would like that to be listed as the ratio. Right now i get both iif
i take out the >1. I tried to change the query to add the Totals field and
add MIN to exp1 and exp2 but i get an error message. Thanks for the help.

Qaspec

KARL DEWEY said:
Create a table name CountNUM with a field named CountNUM with numbers 1
through 99.
SELECT Fruit.Apples, Fruit.Oranges, [Apples]/[CountNUM] & " : " &
[Oranges]/[CountNUM] AS Ratio
FROM Fruit, CountNumber
WHERE (((CountNumber.CountNUM)>1) AND
(([Apples]/[CountNUM])=Int([Apples]/[CountNUM])) AND
(([Oranges]/[CountNUM])=Int([Oranges]/[CountNUM])))
ORDER BY Fruit.Apples, Fruit.Oranges;


If the two numbers are at the lowest ratio value they will not be displayed.
If you remove the criteria of >1 then the ratios listed will include the
orignal also.
--
KARL DEWEY
Build a little - Test a little


:

I have the fields Apples and Oranges. I would like to show the ratio of
Apples to Oranges. If there are 4 Apples and 6 Oranges I would like to have
another field that would contain the ratio 2:3 (Apples:Oranges). Is this
possible? Thanks

Qaspec
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top