countif counting two arguments

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel Training and help » CountIf (counting two arguments)

CountIf (counting two arguments)

resolvedResolved · High Priority · Version 2003

Gareth has attended:
Excel VBA Intro Intermediate course
Excel Intermediate course
Excel Advanced course

CountIf (counting two arguments)

Hi All

I have a database where I need to count two arguments.

I have two columns that I need to count. One the 'District' where the data is either labelled D1, D2 or D3.

Secondly I have a Priority Column labelled either "Gold" "Silver" or "Bronze"

First of all I need to look in column K to see what District is entered, then I need to go over to column U and count how many Districts labelled "D1" have the priority status "Gold"

I need something to return D1 has 5 Gold Status Priorites etc etc

I have tried using the countif function but become stuck.

Any help greatly appreciated.

Regards

Gareth.

RE: CountIf (counting two arguments)

Hello Gareth

Thank you for your question.

There are a couple of ways you could go about doing this.

Firstly you could filter the 'District' column, then filter the 'Priority' column; Excel should give you a count on the left hand side of the status bar at the bottom of your screen to tell you how many records are showing in the filter results (displayed as X of Y records).

Secondly you could filter the 'District' column, then use the Subtotal function to count only visible cells in the Priority column. Because your Priority column in text-based, use the Subtotal for Counta rather than Count. More explanation is provided here:
http://www.ozgrid.com/Excel/excel-subtotal-function.htm

Thirdly you could use an advanced filter, where you set up your criteria separately from your list/database. For more information look up advanced filter in Excel help or see:
http://www.contextures.com/xladvfilter01.html for an example.

I hope this helps.

Kind regards
Amanda

RE: CountIf (counting two arguments)

Amanda

Thanks for the response. However, is there out of curiosity a function or formula that could achieve this?

On my database im trying to have a front page that consolidates and summarises the data for other people.

Thanks again

Gareth.

RE: CountIf (counting two arguments)

Hi Gareth

Thanks for the further explanation.

I think that SUMPRODUCT might help you, I'm not really familiar with this function myself but there is a bit of information about it here:
http://www.contextures.com/xlFunctions01.html #SumProduct

Let me know how you get on with using this, if you have any problems send me a reply and I'll have a look into it.

Kind regards
Amanda

RE: CountIf (counting two arguments)

Amanda

A million thanks yous, the sum product function work wonders!

I also have another query for this particular database that I could run past you if you dont mind?!

In one of the columns I have worked out how many days there are between two dates.

At the front of my database I want a formula that works out how many clients will be returning in the next 7 days.

So basically a function that counts the number of entries >= 0 and <= 7 in a column.

Any ideas?

Thanks again.



RE: CountIf (counting two arguments)

Hi Gareth

Glad to hear that worked out :)

For your second question, I think you can get Excel to calculate this for you by creating a formula that subtracts the result of one COUNTIF from another, to count how many entries fall within a certain range - see here:
http://www.contextures.com/xlFunctions04.html #Range

Kind regards
Amanda

RE: CountIf (counting two arguments)

Hi Gareth
you could try this assuming that your data id in Col F the range is F1 to F6 this can be changed =SUMPRODUCT(--($F$1:$F$6>0),--($F$1:$F$6<8))


 

Excel tip:

Sorting List Subtotals

If you find that you would prefer to show the items in a subtotalled list in a different order, eg ascending rather than descending, you can sort your list. To sort a subtotalled list, hide the detail rows and then sort the subtotal rows. When you sort a subtotalled list, the hidden detail rows are automatically moved with the subtotal rows.
IMPORTANT: If you do not hide the details rows before sorting a subtotalled list, your subtotals will be removed and all of the rows in your list will be reordered.

View all Excel hints and tips


Server loaded in 0.08 secs.