Anyone Help me with a query ?

traversd

Board Regular
Joined
Mar 17, 2002
Messages
82
Hi,

i have a query made up from two other queries that count the number of goals or assists a player has scored for a hockey team.

When I try to add the two columns together using;
Total: [CountOfNumber_A1]+[CountOfNumber_A2] it will only add up the rows where there is a number on both i.e. a Goal AND an assist...it won't carry through say 4 goals and NO assists to give a total of 4 points...


Anyone help with that ?
Cheers
Darren
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hi Darren,

Try this:

Total: IIf(IsNull([CountOfNumber_A1]),0,[CountOfNumber_A1])+IIf(IsNull([CountOfNumber_A2]),0,[CountOfNumber_A2])

I hope it helps.

Suat
 
Upvote 0
In the Criteria of the columns write:

nz([yourcolumn1],0)
nz([yourcolumn2],0)

That way, all Nulls will be replaced with a 0 so that the query can correctly add the values.
 
Upvote 0

Forum statistics

Threads
1,223,536
Messages
6,172,897
Members
452,488
Latest member
jamesgeorgewalker

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