dbTalk Databases Forums  

help re-write report formula

comp.databases.ms-access comp.databases.ms-access


Discuss help re-write report formula in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bobh
 
Posts: n/a

Default help re-write report formula - 08-18-2010 , 02:26 PM






Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

thanks
bobh.

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: help re-write report formula - 08-18-2010 , 03:07 PM






bobh wrote:

Quote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. Then you could use Dlookup() or some
flavor of it.

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: help re-write report formula - 08-19-2010 , 03:38 AM



On 18/08/2010 21:07:37, Salad wrote:
Quote:
bobh wrote:

Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. Then you could use Dlookup() or some
flavor of it.

Try IIf(Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)) = 0,"-",
Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/ >>
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0))

Hope that shows a dash if Sum(IIf([MthFor]="jan" And
[EntryType]="l",[WalkAway],0)) = 0 and does the calculation if it is not zero

Phil

Reply With Quote
  #4  
Old   
bobh
 
Posts: n/a

Default Re: help re-write report formula - 08-20-2010 , 10:42 AM



On Aug 19, 4:38*am, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 18/08/2010 21:07:37, Salad wrote:





bobh wrote:

Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

Try IIf(Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)) =0,"-",
Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0))

Hope that shows a dash if Sum(IIf([MthFor]="jan" And
[EntryType]="l",[WalkAway],0)) = 0 and does the calculation if it is not zero

Phil- Hide quoted text -

- Show quoted text -
That's works, thanks Phil
bobh.

Reply With Quote
  #5  
Old   
bobh
 
Posts: n/a

Default Re: help re-write report formula - 08-20-2010 , 10:54 AM



On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.
actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Reply With Quote
  #6  
Old   
Phil
 
Posts: n/a

Default Re: help re-write report formula - 08-20-2010 , 11:31 AM



On 20/08/2010 16:54:37, bobh wrote:
Quote:
On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Well where I have the "-" in the IIf clause, you can substitute what you want
from "0" to "No sales for " & MthFor

Reply With Quote
  #7  
Old   
bobh
 
Posts: n/a

Default Re: help re-write report formula - 08-20-2010 , 03:23 PM



On Aug 20, 12:31*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 20/08/2010 16:54:37, bobh wrote:





On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Div/
0! error and I'm not getting anywhere fast. This is in a YTD report so
each month box has this formula but for each month. I tried to add the
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary totals
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Well where I have the "-" in the IIf clause, you can substitute what you want
from "0" to "No sales for " & MthFor- Hide quoted text -

- Show quoted text -
I did..... replaced it with "0.00%"
thanks

Reply With Quote
  #8  
Old   
Phil
 
Posts: n/a

Default Re: help re-write report formula - 08-20-2010 , 03:53 PM



On 20/08/2010 21:23:19, bobh wrote:
Quote:
On Aug 20, 12:31*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
On 20/08/2010 16:54:37, bobh wrote:





On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Di
v/
0! error and I'm not getting anywhere fast. This is in a YTD report
so
each month box has this formula but for each month. I tried to add t
he
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))
/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary total
s
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Well where I have the "-" in the IIf clause, you can substitute what you
want
from "0" to "No sales for " & MthFor- Hide quoted text -

- Show quoted text -

I did..... replaced it with "0.00%"
thanks

So if you're january sales are 0 (MthFor]="jan") and WalkAway not = 0 then
the division will take place and the answer will be 0 That is why I suggested
a different symbol ("-" or "No sales for January) to differentiate between a
zero or non zero value of WalkAway

Phil

Reply With Quote
  #9  
Old   
Roger
 
Posts: n/a

Default Re: help re-write report formula - 08-21-2010 , 07:19 AM



On Aug 20, 2:53*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 20/08/2010 21:23:19, bobh wrote:





On Aug 20, 12:31*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
On 20/08/2010 16:54:37, bobh wrote:

On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Di
v/
0! error and I'm not getting anywhere fast. This is in a YTD report
so
each month box has this formula but for each month. I tried to add t
he
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))
/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary total
s
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Well where I have the "-" in the IIf clause, you can substitute what you
want
from "0" to "No sales for " & MthFor- Hide quoted text -

- Show quoted text -

I did..... *replaced it with * "0.00%"
thanks

So if you're january sales are 0 (MthFor]="jan") and WalkAway not = 0then
the division will take place and the answer will be 0 That is why I suggested
a different symbol ("-" or "No sales for January) to differentiate between a
zero or non zero value of WalkAway

Phil- Hide quoted text -

- Show quoted text -
isn't anything / 0, infinity
and isn't infinity, 100%

Reply With Quote
  #10  
Old   
bobh
 
Posts: n/a

Default Re: help re-write report formula - 08-25-2010 , 03:09 PM



On Aug 20, 4:53*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
Quote:
On 20/08/2010 21:23:19, bobh wrote:





On Aug 20, 12:31*pm, "Phil" <p... (AT) stantonfamily (DOT) co.uk> wrote:
On 20/08/2010 16:54:37, bobh wrote:

On Aug 18, 4:07*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
bobh wrote:
Hi,
This fomrula is in the control source of each unbound box in the
report and I'm looking to re-write this formula to cover for the #Di
v/
0! error and I'm not getting anywhere fast. This is in a YTD report
so
each month box has this formula but for each month. I tried to add t
he
'IsError' function but I couldn't getting it right. Anybody got a
resolve so that the formula will place a 0(zero) in the box if the
calc produces a #Div/0! *error.

=Nz(Sum(IIf([MthFor]="jan" And [EntryType]="l",[LODamages],0))
/
Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0)),0)

I guess you'd want to know if the
* Sum(IIf([MthFor]="jan" And [EntryType]="l",[WalkAway],0))
value is zero or not before calcing (dividing).

I might consider, not having seen you report, having a secondary total
s
query on month and entry type. *Then you could use Dlookup() or some
flavor of it.

actually I was hoping to trap the Div/o error at calculation time and
display a 0 in it's place, if that makes any sense.
I also had thoughts about totals query and storing the results in a
temp table and making the temp table the record source of the report
but that in my thinking was alot of stuff to do so my first idea was
to modify the existing report formula to capture the Div/0 error and
replace it with a 0.
bobh.

Well where I have the "-" in the IIf clause, you can substitute what you
want
from "0" to "No sales for " & MthFor- Hide quoted text -

- Show quoted text -

I did..... *replaced it with * "0.00%"
thanks

So if you're january sales are 0 (MthFor]="jan") and WalkAway not = 0then
the division will take place and the answer will be 0 That is why I suggested
a different symbol ("-" or "No sales for January) to differentiate between a
zero or non zero value of WalkAway

Phil- Hide quoted text -

- Show quoted text -
I understand what you're saying but in this case, for this report,
it's not necessary to distinguish between them, the users wanted to
see a 0.00% if their side of the calculation had a zero(0) value. Be
it right or wrong, good or bad that's what the customer wanted so
that's what there getting.
bobh

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.