count help

amna77

Active Member
Joined
May 9, 2002
Messages
251
hi, in my query i have 11 fields, all those all fields have P and F. what i want to do is I want to count P and F, like how many P's and how many F's. any idea how would i do that.
I try to do count, but not working, I might be doing something wrong. please help me , thanks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi, I got it to work by doing the following :

Create a new query -> design view -> ok -> add the table or query with the 11 fields -> add -> close, Click Query -> View Totals.

In the first field enter this :

P : IIf([1]="P",1,0)+ IIf([2]="P",1,0)+ IIf([3]="P",1,0)+ IIf([4]="P",1,0)+ IIf([5]="P",1,0)+ IIf([6]="P",1,0)+ IIf([7]="P",1,0)+ IIf([8]="P",1,0)+ IIf([9]="P",1,0)+ IIf([10]="P",1,0)+ IIf([11]="P",1,0)

But use your own variable names (I used [1] to [11])

Change the total line from "Group By" to "Sum".

In the second field enter this :

F : IIf([1]="F",1,0)+ IIf([2]="F",1,0)+ IIf([3]="F",1,0)+ IIf([4]="F",1,0)+ IIf([5]="F",1,0)+ IIf([6]="F",1,0)+ IIf([7]="F",1,0)+ IIf([8]="F",1,0)+ IIf([9]="F",1,0)+ IIf([10]="F",1,0)+ IIf([11]="F",1,0)

But use your own variable names (I used [1] to [11])

Again, change the total line from "Group By" to "Sum" to get a grand total of P's and F's - unless you want to see the count of P's and F's for each record, then leave it as group by.

A crude method, but it works.

HTH, Andrew. :)
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,248
Members
451,756
Latest member
tommyw

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