Issue when summing fields containing Iif expression

howardt

New Member
Joined
Nov 15, 2005
Messages
11
Ok, long time viewer, first time poster:

I have a list of Bank presentations, each has a specific dollar amount.

Before the Presentation is accepted by the bank the Amount Accepted field returns 0.00.

When it is accepted the Accepted? field is checked and the Amount Accepted field returns the specific amount for that Presentation. This bit is fine and is done by the expression:

Amount Accepted = IIf(([Accepted?])=Yes,[Amount],0)

The issue arises when I need to sum the all the Amount Accepted values. Hence when I have my calculated control in the footer of the subform with expression:

SumofPresentations = Sum([Amount Accepted])

It returns #Error. The eternal question: WHY?


ta,

ht
 

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
Hello and welcome to MrExcel.

I haven't tested this but have you tried using something like this:

=Sum(IIf([Accepted?],[Amount],0))

HTH, Andrew :)
 

howardt

New Member
Joined
Nov 15, 2005
Messages
11

ADVERTISEMENT

Hi Andrew,

Your code works fine in the subform to give me what I need
=Sum(IIf([Accepted?]=Yes,[Amount],0))

Then when I try to repeat the calculation in the main form with:
=Sum(IIf([Presentations subform].Form![Accepted?]=Yes,[Presentations subform].Form!Amount,0)).

I get my same old #Error. Any ideas why?
 

Andrew Fergus

MrExcel MVP
Joined
Sep 9, 2004
Messages
5,432
Hi

You can't directly reference the items on the subform like that but you can reference the total on the subform. To see how to do this, follow this link for a full blown explanation.

HTH, Andrew :)
 

howardt

New Member
Joined
Nov 15, 2005
Messages
11
Andrew,

Thanks for your help, the issue was confused as I hadn't told the form to refresh.

All done to my satisfaction now though.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,057
Messages
5,569,954
Members
412,299
Latest member
agentless
Top