Is that your Final Answer?????

M

mattsmom

I have an unbound, calculated text box (named NANFA_FLD) which contains the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to 3.
This works great; however, I need to go one set further. I need to take the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like "NFAâ€
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is 2; using
"FA" my final answer should be 1515.97... I keep getting 1517.50..... what am
I doing wrong????
 
S

Sylvain Lafontaine

429452.5 / 283 = 1517.5; so I don't understand why you think this should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are testing
first for NFA and then for FA but for the second equation, you have reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)
 
M

mattsmom

Sylvain, Thanks for your quick response. I changed "Like" to "=" and put the
order back. I have looked at this for two days and was changing everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" , 2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my error.

Sylvain Lafontaine said:
429452.5 / 283 = 1517.5; so I don't understand why you think this should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are testing
first for NFA and then for FA but for the second equation, you have reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
I have an unbound, calculated text box (named NANFA_FLD) which contains the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to 3.
This works great; however, I need to go one set further. I need to take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like "NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is 2;
using
"FA" my final answer should be 1515.97... I keep getting 1517.50..... what
am
I doing wrong????
 
F

Fred

Probably not the issue, but why have the uncertainty of (in some cases)
putting a space (" ") as an input into a mathematical equation?
 
B

BruceM

I would try using the expression rather than the name of the calculated text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to avoid
unwanted text wrapping in your newsreader.

mattsmom said:
Sylvain, Thanks for your quick response. I changed "Like" to "=" and put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my error.

Sylvain Lafontaine said:
429452.5 / 283 = 1517.5; so I don't understand why you think this should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
I have an unbound, calculated text box (named NANFA_FLD) which contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to 3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like "NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is 2;
using
"FA" my final answer should be 1515.97... I keep getting 1517.50.....
what
am
I doing wrong????
 
M

mattsmom

Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to avoid
unwanted text wrapping in your newsreader.

mattsmom said:
Sylvain, Thanks for your quick response. I changed "Like" to "=" and put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my error.

Sylvain Lafontaine said:
429452.5 / 283 = 1517.5; so I don't understand why you think this should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to 3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like "NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is 2;
using
"FA" my final answer should be 1515.97... I keep getting 1517.50.....
what
am
I doing wrong????
 
S

Sylvain Lafontaine

The first equation doesn't equal 0.00353; it equals to 0.00335689...
(followed by many other decimals). The fact that Access displays 0.00353
doesn't mean that it will use 0.00353 to complet your second part of the
equation. When calculating, Access will use the real value; which is
0.003356890... and will give you the correct answer of 1517.5 instead of
1515.97.

If you want to get 1515.97 instead of 1517.5; you must first truncate the
result of the first equation to be really 0.00353 by using one of the
rounding or floor functions of Access.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

mattsmom said:
Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to
3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
B

BruceM

In your example, as I understand the value of the first expression:
Sum([FLD])*0.5/390)
is .00353. Do I understand correctly so far?

Now you want to find .353% of 429452.5. The expression therefore is:
429452.5 * .00353
which produces the result 1515.97 (rounded to two decimal places). I
entered the numbers quite carefully several times in a row, and kept coming
up with the same result. I cannot get it to come to 1517.50.

When you showed the two expressions you evaluated Text98 for "NFA" first in
one expression and second in the other, and vice versa for "FA". You may
not be using the numbers you think you are.

Remember, percent is a way of expressing a number. One percent (1%) is a
way to express the number .01.

What are the actual numbers, and what results do you expect?

mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

mattsmom said:
Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to
3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
B

BruceM

Ah! That's the part I was missing.

Sylvain Lafontaine said:
The first equation doesn't equal 0.00353; it equals to 0.00335689...
(followed by many other decimals). The fact that Access displays 0.00353
doesn't mean that it will use 0.00353 to complet your second part of the
equation. When calculating, Access will use the real value; which is
0.003356890... and will give you the correct answer of 1517.5 instead of
1515.97.

If you want to get 1515.97 instead of 1517.5; you must first truncate the
result of the first equation to be really 0.00353 by using one of the
rounding or floor functions of Access.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals
.00353
and when that is multlipied by the 429452.5 it does come to 1517.50.
When I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of
[NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect
that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set
to 3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
M

mattsmom

Yes, Bruce, you are understanding correctly. But I can't just use the
expression 429452.5*.00353 because each month the percentage will change.

I corrected the code after the original post, this is copied and pasted from
exactly as it is:

This unbound calculated box is named [NANFA_FLD]
=IIf([Text98]="NFA",-Sum([FLD])*0.5/390,IIf([Text98]="FA",-Sum([FLD])*0.5/283,""))

[FLD] = 2 therefore 2*.5/283 = 0.35336

The second part of the code to get the dollar amount is:

=IIf([Text98]="NFA",591825*[NANFA_FLD],IIf([Text98]="FA",429452.5*[NANFA_FLD],""))

The amount I expect to get is what you came up with 1515.97; however I keep
getting 1517.50....



BruceM said:
In your example, as I understand the value of the first expression:
Sum([FLD])*0.5/390)
is .00353. Do I understand correctly so far?
Now you want to find .353% of 429452.5. The expression therefore is:
429452.5 * .00353
which produces the result 1515.97 (rounded to two decimal places). I
entered the numbers quite carefully several times in a row, and kept coming
up with the same result. I cannot get it to come to 1517.50.

When you showed the two expressions you evaluated Text98 for "NFA" first in
one expression and second in the other, and vice versa for "FA". You may
not be using the numbers you think you are.

Remember, percent is a way of expressing a number. One percent (1%) is a
way to express the number .01.

What are the actual numbers, and what results do you expect?



mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to
3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
M

mattsmom

Sylvain,
I tried rounding yesterday, but it rounded to .4 which made the end result
greater than the actual amount. At this point I couldn't even tell you what
I did, or if I could even do it again....

Sylvain Lafontaine said:
The first equation doesn't equal 0.00353; it equals to 0.00335689...
(followed by many other decimals). The fact that Access displays 0.00353
doesn't mean that it will use 0.00353 to complet your second part of the
equation. When calculating, Access will use the real value; which is
0.003356890... and will give you the correct answer of 1517.5 instead of
1515.97.

If you want to get 1515.97 instead of 1517.5; you must first truncate the
result of the first equation to be really 0.00353 by using one of the
rounding or floor functions of Access.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to
3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
M

mattsmom

thank you both so much!!!!!! The code I used is......
=IIf([Text98]="NFA",Fix(-Sum([FLD])*0.5/390*100000)/100000,IIf([Text98]="FA",Fix(-Sum([FLD])*0.5/283*100000)/100000,""))

It works like a charm!!!

You all rock!

Sylvain Lafontaine said:
The first equation doesn't equal 0.00353; it equals to 0.00335689...
(followed by many other decimals). The fact that Access displays 0.00353
doesn't mean that it will use 0.00353 to complet your second part of the
equation. When calculating, Access will use the real value; which is
0.003356890... and will give you the correct answer of 1517.5 instead of
1515.97.

If you want to get 1515.97 instead of 1517.5; you must first truncate the
result of the first equation to be really 0.00353 by using one of the
rounding or floor functions of Access.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals .00353
and when that is multlipied by the 429452.5 it does come to 1517.50. When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

BruceM said:
I would try using the expression rather than the name of the calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "=" and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of [NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set to
3.
This works great; however, I need to go one set further. I need to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD] is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
S

Sylvain Lafontaine

Sometimes in cases like this, you have to follow strict rules and you might
have to add a 0.5 before doing the rounding. Check the rules to know what
you have to do.

Also, it might be a good idea to store the result of the calculations
directly in the database; as this might simplify a lot of things later.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
thank you both so much!!!!!! The code I used is......
=IIf([Text98]="NFA",Fix(-Sum([FLD])*0.5/390*100000)/100000,IIf([Text98]="FA",Fix(-Sum([FLD])*0.5/283*100000)/100000,""))

It works like a charm!!!

You all rock!

Sylvain Lafontaine said:
The first equation doesn't equal 0.00353; it equals to 0.00335689...
(followed by many other decimals). The fact that Access displays 0.00353
doesn't mean that it will use 0.00353 to complet your second part of the
equation. When calculating, Access will use the real value; which is
0.003356890... and will give you the correct answer of 1517.5 instead of
1515.97.

If you want to get 1515.97 instead of 1517.5; you must first truncate the
result of the first equation to be really 0.00353 by using one of the
rounding or floor functions of Access.

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and SQL-Server
(French)


mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals
.00353
and when that is multlipied by the 429452.5 it does come to 1517.50.
When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

:

I would try using the expression rather than the name of the
calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "="
and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of
[NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect
that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way
of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate
instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set
to
3.
This works great; however, I need to go one set further. I need
to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD]
is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 
B

BruceM

I understand that the number is calculated, which generally means it is not
a fixed value. I was just trying to get a handle on what you are trying to
do, so I used an actual number here rather than restating the expression. I
suggested earlier that you use an expression, which I hope demonstrated that
I understood the need for a calculated value

Remember that formatting in NANFA_FLD applies only to NANFA_FLD. When the
number is referenced in another text box it will not be formatted. As an
experiment, add another text box with the Control Source =[NANFA_FLD].

You should be able to do something like this:
=IIf([Text98]="NFA",591825*Round([NANFA_FLD],5),IIf([Text98]
="FA",429452.5*Round([NANFA_FLD],5),""))

Your expression using Fix may work, but as Sylvain pointed out it could be
inaccurate in some cases. For that matter I suppose my suggestion could be
inaccurate too, but I think it will round the number reliably.

mattsmom said:
Yes, Bruce, you are understanding correctly. But I can't just use the
expression 429452.5*.00353 because each month the percentage will change.

I corrected the code after the original post, this is copied and pasted
from
exactly as it is:

This unbound calculated box is named [NANFA_FLD]:
=IIf([Text98]="NFA",-Sum([FLD])*0.5/390,IIf([Text98]="FA",-Sum([FLD])*0.5/283,""))

[FLD] = 2 therefore 2*.5/283 = 0.35336

The second part of the code to get the dollar amount is:

=IIf([Text98]="NFA",591825*[NANFA_FLD],IIf([Text98]="FA",429452.5*[NANFA_FLD],""))

The amount I expect to get is what you came up with 1515.97; however I
keep
getting 1517.50....



BruceM said:
In your example, as I understand the value of the first expression:
Sum([FLD])*0.5/390)
is .00353. Do I understand correctly so far?
Now you want to find .353% of 429452.5. The expression therefore is:
429452.5 * .00353
which produces the result 1515.97 (rounded to two decimal places). I
entered the numbers quite carefully several times in a row, and kept
coming
up with the same result. I cannot get it to come to 1517.50.

When you showed the two expressions you evaluated Text98 for "NFA" first
in
one expression and second in the other, and vice versa for "FA". You may
not be using the numbers you think you are.

Remember, percent is a way of expressing a number. One percent (1%) is a
way to express the number .01.

What are the actual numbers, and what results do you expect?



mattsmom said:
Thanks Bruce, I tried that too. The first equation actually equals
.00353
and when that is multlipied by the 429452.5 it does come to 1517.50.
When
I
change to box to percent (.353) it still reads the .00353. I've tried
multiplying by 100 and then 429452.5.... I've tried all sorts of silly
things
to make it work, but it still is not calculating correctly.

:

I would try using the expression rather than the name of the
calculated
text
box in the second expression:

=IIf([Text98] = "NFA",(-Sum([FLD])*0.5/390)*591825,
IIf([Text98] = "FA",(-Sum([FLD])*0.5/283)*429452.5," "))

The expression is on one line. I wrote it as I did in an attempt to
avoid
unwanted text wrapping in your newsreader.

Sylvain, Thanks for your quick response. I changed "Like" to "="
and
put
the
order back. I have looked at this for two days and was changing
everything I
could think of.

In the first equation [NANFA_FLD], using 2 as [FLD] sum and "FA" ,
2*.5/283
= .353
In the second equation I want 429452.5 *.353 (the value of
[NANFA_FLD])

My brain must be dead, because after two days I still can't see my
error.

:

429452.5 / 283 = 1517.5; so I don't understand why you think this
should
give 1515.97 instead as the final answer.

What's funny is that 591825 / 390 also gives 1517.5; so I suspect
that
you
have got something mixed up here.

As a side note, keeping the same order of evaluation is a good way
of
keeping things clear as possible. In your first equation, you are
testing
first for NFA and then for FA but for the second equation, you have
reversed
the order. Mixing things is a good way of creating errors.

I also don't understand why you are using the LIKE predicate
instead
of
using the equality = for testing against FA and NFA.)

--
Sylvain Lafontaine, ing.
MVP - Windows Live Platform
Email: sylvain2009 sylvainlafontaine com (fill the blanks, no spam
please)
Independent consultant and remote programming for Access and
SQL-Server
(French)


I have an unbound, calculated text box (named NANFA_FLD) which
contains
the
following code:

=IIf([Text98] Like "NFA",-Sum([FLD])*0.5/390,IIf([Text98] Like
"FA",-Sum([FLD])*0.5/283," "))

The text box has its format set to Percent and Decimal Places set
to
3.
This works great; however, I need to go one set further. I need
to
take
the
calculated percentage from above and multiply it by a set number.

=IIf([Text98] Like "FA",[NANFA_FLD]* 429452.5,IIf([Text98] Like
"NFA"
[NANFA_FLD]* 591825," "))

But this does not calculate correctly. The current sum of [FLD]
is
2;
using
"FA" my final answer should be 1515.97... I keep getting
1517.50.....
what
am
I doing wrong????
 

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

Top