Simple Query Probably / But not simple enough for me lol :)

bayside blue

New Member
Joined
Jul 27, 2004
Messages
10
I need a query that looks at a number of fields,

Status 6 achieved... 5... 4... 3... 2... etc.

But it must only count them if the next field is empty and exclude the fields before

i.e.

Status 5 Achieved :
Status 4 Achieved : 10/10/03
Status 3 Achieved : 22/04/03
Status 2 Achieved : 10/03/03

So that this example it would count status 4 but leave Status 3 & 2 out of the count.

At the moment i have all the fields listed in the query. Is there a formula i can use to say only count this if the next field it looks like in the query is blank.

Many thanks,
Martin :biggrin:
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Re: Simple Query Probably / But not simple enough for me lol

you could do it with an if statement

in b1 =if(a1="",1,0)
put that next to it then it would only display a 1 once. then you can count that. either that or a macro.
 
Upvote 0
Re: Simple Query Probably / But not simple enough for me lol

Would that work in access?? Looks similar to excel? :)
 
Upvote 0
Re: Simple Query Probably / But not simple enough for me lol

Try this: Create a calculated expression in a query.
Max_Status: IIf([Status 6 Acheived]>0,6,IIf([Status 5 Acheived]>0,5,IIf([Status 4 Acheived]>0,4,IIf([Status 3 Acheived]>0,3,IIf([Status 2 Acheived]>0,2,IIf([Status 1 Acheived]>0,1,0))))))
Then build a second query using this one as the source. Add the Max_Status field TWICE.
Turn it into a Totals query by clicking the Sigma button on the query design toolbar. In the first occurrence of Max_Status, leave the summary as Group By. In the second, change the summary function to Count.

Denis
 
Upvote 0
Re: Simple Query Probably / But not simple enough for me lol

hadnt realized I was in access :eek: nevermind. what he said (y)
 
Upvote 0
Re: Simple Query Probably / But not simple enough for me lol

Thanks alot :biggrin:

Miccysoft too for the good intention :biggrin:
 
Upvote 0

Forum statistics

Threads
1,221,810
Messages
6,162,108
Members
451,743
Latest member
matt3388

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