Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Flag for Zambia asked on

Accounts Receivables aging

=IF(AND(TODAY()-$C5<=60,TODAY()-$C5>30),$D5,0)
The above formula is an example of multiple IF statements in excel or multiple criteria where each criteria is joined using AND function. AND function does literally the same thing as the and does in language. So the above formula will be read like this in plain English:
If difference between today’s date and the date in cell C5 is less than or equal to 60 days AND the difference between today’s date and the date in cell C5 is greater than 30 days than fetch the value from cell D5 otherwise put 0.

$C5 represents the filed date
$D5 represents the invoice amount

Now in excel it works very I have tested it , I want to use it in MS Access as well , I have tried like below but it does not work:

=IF(AND(Date()-[MMDate]<=60,Date()-[MMDate]>30),[LineTotal],0)

The above code is supposed to age those amounts in above 30 days and below 60 days

How do I fix it

Sorry to disturb your holiday

Regards

Chris
Microsoft Access

Avatar of undefined
Last Comment
Scott McDaniel (EE MVE )

8/22/2022 - Mon
als315

Query could be:
SELECT Sum(LineTotal) AS SumOfLineTotal
FROM YourTable
WHERE (((Date()-[MMDate])>30 And (Date()-[MMDate])<=60));

Open in new window

replace
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc

ASKER
Still what about >60 days >90 days > 120 days
or simple terms

Why this code does not work in Ms Access

=IF(AND(Date()-[MMDate]<=60,Date()-[MMDate]>30),[LineTotal],0)

Or

=IIF(AND (Datediff("d",[MMDate],Date()))<=60,(Datediff("d",[MMDate],Date())>30),[LineTotal],0)

Could it be the AND operator???????
SOLUTION
als315

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Scott McDaniel (EE MVE )

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy