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
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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 :)
 
Upvote 0
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?
 
Upvote 0
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 :)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,216,577
Messages
6,131,509
Members
449,654
Latest member
andz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top