Using > and < to count or sum functions

T

T-bird

I have a report and I need to count the number of times per group, that
airfare was booked 21 or more, 14-20, and 13 or less days in advance. The
days advance purchse is a number listed in the "DAYSADV" column of a table. I
have tried:

=Sum(Abs([DAYSADV] >="21")) and
=Count(Abs([DAYSADV] >= "21"))

but I get an error that tells me my expression is to complex. Please tell me
what I'm doing wrong is there another expression or function I should be
using?
 
A

Allen Browne

If DaysAdv is a Number field (not a Text field) try without the quotes,
e.g.:
=Sum(Abs([DAYSADV] >=21))
 
J

John Spencer

Is DaysAdv a number field or a text field?
Assumption:
DaysAdv is a Number field.

=Abs(Sum(DaysAdv>20))

=Abs(Sum(DaysAdv<=13))

= Abs(Sum(DaysAdv>13 and DayAdv<21))
 
T

T-bird

I enter that in for the second criteria for the 14-20 days and I get a
negative number this is my expresion is somethin wrong or a format incorrect?

=Sum(Abs([DAYSADV]<=20) And ([DAYSADV]>=14))

Allen Browne said:
If DaysAdv is a Number field (not a Text field) try without the quotes,
e.g.:
=Sum(Abs([DAYSADV] >=21))
--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

T-bird said:
I have a report and I need to count the number of times per group, that
airfare was booked 21 or more, 14-20, and 13 or less days in advance. The
days advance purchse is a number listed in the "DAYSADV" column of a
table. I
have tried:

=Sum(Abs([DAYSADV] >="21")) and
=Count(Abs([DAYSADV] >= "21"))

but I get an error that tells me my expression is to complex. Please tell
me
what I'm doing wrong is there another expression or function I should be
using?
 
T

T-bird

DAYsADV is a number field

John Spencer said:
Is DaysAdv a number field or a text field?
Assumption:
DaysAdv is a Number field.

=Abs(Sum(DaysAdv>20))

=Abs(Sum(DaysAdv<=13))

= Abs(Sum(DaysAdv>13 and DayAdv<21))

T-bird said:
I have a report and I need to count the number of times per group, that
airfare was booked 21 or more, 14-20, and 13 or less days in advance. The
days advance purchse is a number listed in the "DAYSADV" column of a
table. I
have tried:

=Sum(Abs([DAYSADV] >="21")) and
=Count(Abs([DAYSADV] >= "21"))

but I get an error that tells me my expression is to complex. Please tell
me
what I'm doing wrong is there another expression or function I should be
using?
 
A

Allen Browne

Your bracketing looks wrong.

Perhaps:
=Sum(Abs(([DaysAdv] >= 14) AND ([DaysAdv] <=20)))

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

T-bird said:
I enter that in for the second criteria for the 14-20 days and I get a
negative number this is my expresion is somethin wrong or a format
incorrect?

=Sum(Abs([DAYSADV]<=20) And ([DAYSADV]>=14))

Allen Browne said:
If DaysAdv is a Number field (not a Text field) try without the quotes,
e.g.:
=Sum(Abs([DAYSADV] >=21))
T-bird said:
I have a report and I need to count the number of times per group, that
airfare was booked 21 or more, 14-20, and 13 or less days in advance.
The
days advance purchse is a number listed in the "DAYSADV" column of a
table. I
have tried:

=Sum(Abs([DAYSADV] >="21")) and
=Count(Abs([DAYSADV] >= "21"))

but I get an error that tells me my expression is to complex. Please
tell
me
what I'm doing wrong is there another expression or function I should
be
using?
 
T

T-bird

I have another issue, now that I am able to count the number of times a
ticket was purchased 21 days in advance, I need to calculate a percentage of
what that ticket amount is in relation to the total ticket purchase amount
for the division. Such as...

DIVISION TICKET AMT DAYSADV Division Total
CORPORATE $339.70 15 $10191.00

The top lines are field names with the exception of Division Total which is
a text box name that has a calculation of "=Sum ([TICKET AMT]) this text box
is located on sub report named ETSsubrpt1. I hope this is not too complicated
to do. The calculations are done by hand and we have now designed an Access
database to do them but getting all the formulas in has turned out to be
tricky.


T-bird said:
DAYsADV is a number field

John Spencer said:
Is DaysAdv a number field or a text field?
Assumption:
DaysAdv is a Number field.

=Abs(Sum(DaysAdv>20))

=Abs(Sum(DaysAdv<=13))

= Abs(Sum(DaysAdv>13 and DayAdv<21))

T-bird said:
I have a report and I need to count the number of times per group, that
airfare was booked 21 or more, 14-20, and 13 or less days in advance. The
days advance purchse is a number listed in the "DAYSADV" column of a
table. I
have tried:

=Sum(Abs([DAYSADV] >="21")) and
=Count(Abs([DAYSADV] >= "21"))

but I get an error that tells me my expression is to complex. Please tell
me
what I'm doing wrong is there another expression or function I should be
using?
 

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