Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to get a conditional sum from a data comparison

Status
Not open for further replies.

michpaust

Technical User
Jul 22, 2004
2
US
Here's my problem. I have two columns, one represents the amt of days an item has to be delivered by, for example "the ball" must be delivered within 2 days of order issued date. The other column represents the actual number of days that it took for "the ball" to be delivered. What I need to do is compare actual delivery days with standard delivery dates and spit out three sets of info

Items delivered in less time than standard
Items delivered in equal time to standard
Items delivered in greater time than std

The expression I used is as follows
=Sum(IIf([Actual Delivery]<[Standard delivery],1,0))

However I don' get any kind of result. What am I doing wrong?

I hope I have made myself clear and not confused anyone!

Help Please! Thanks!!!!!
 
michpaust
Here's one approach...

In the Detail section, put a text box. Its control source would be =[Actual] - [Standard]. Make this invisible if you don't want to see it.

In the Group Footer, put 3 text boxes. Call them something such as txtLess, txtEqual, txtGreater.

The following will give you the txtEqual result.
="Items delivered in standard time " & Sum(Abs([Actual]-[Standard]=0))

You can work out the others, using <0 and >0.

If you want an overall result, put the same in the Report Footer rather than in the Group Footer.

Tom
 
Thank you Tom. That worked. Being 5 1/2 mths pregnant I sometimes get some major periods of brain freeze!
 
michpaust
Glad that helped.

All the best with your database, and also with the remaining months of your pregnancy!

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top