CountIf on non contiguous named range

jakeyjake

New Member
Joined
Aug 8, 2017
Messages
2
Below is a set of data I am working on. I have named the customer satisfaction range as "CustomerSatisfaction" then i have applied a filter on the cities ie filter by "Melbourne" then i have named the customer satisfaction column with the filter on and called it "MelbourneCustomerSatisfaction". If i do a =CountIf(CustomerSatisfaction,5) named range, all works as expected, however if i do somethign like =CountIf(MelbourneCustomerSatisfaction, 2) it seems to just run is as =CountIf(CustomerSatisfaction,2) rather than apply the melbourne filter to it. Can anyone gimme a hand with this?

[TABLE="width: 933"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Recipt No.[/TD]
[TD]Payment type[/TD]
[TD]Customer's city[/TD]
[TD]Sale price ($/ton)[/TD]
[TD]Delivery time (minutes/ton.km)[/TD]
[TD]Customer satisfaction[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Eftpos[/TD]
[TD]Sydney[/TD]
[TD]345[/TD]
[TD]0.57[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]cheque[/TD]
[TD]Melbourne[/TD]
[TD]444[/TD]
[TD]0.32[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Eftpos[/TD]
[TD]Brisbane[/TD]
[TD]434[/TD]
[TD]0.10[/TD]
[TD]8[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]cheque[/TD]
[TD]Sydney[/TD]
[TD]382[/TD]
[TD]0.43[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Eftpos[/TD]
[TD]Sydney[/TD]
[TD]412[/TD]
[TD]0.44[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Eftpos[/TD]
[TD]Sydney[/TD]
[TD]451[/TD]
[TD]0.12[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Eftpos[/TD]
[TD]Canberra[/TD]
[TD]358[/TD]
[TD]0.33[/TD]
[TD]7[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]cash[/TD]
[TD]Brisbane[/TD]
[TD]386[/TD]
[TD]0.67[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]cash[/TD]
[TD]Sydney[/TD]
[TD]407[/TD]
[TD]0.57[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]credit card[/TD]
[TD]Melbourne[/TD]
[TD]345[/TD]
[TD]0.63[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]credit card[/TD]
[TD]Melbourne[/TD]
[TD]390[/TD]
[TD]0.34[/TD]
[TD]4[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Could you go to name manager and see what the refers to part says for 'MelbourneCustomerSatisfaction'. Is it what you expect?
 
Upvote 0
Thanks for your response Steve.

You are right! The named range is not the range that I am after, it chooses random parts of the total column. not sure where excel chooses them from. Is there a way to filter the data and create a range using that filter? Im pretty new to excel so sorry for all the questions and very much appreciate your help.
 
Upvote 0
Welcome to the MrExcel board!

Do you really need to do the filtering?
What version of Excel are you using?

Assuming a reasonably recent version of Excel, here are a couple of options that may be of use.

First, if not done already, turn the data into a formal Excel table (via Insert ribbon tab).

Then you could ...

1. Use a formula like I have in cell H1 to count the Melbourne/2 rows, or

2. Create a Pivot Table (again on the Insert ribbon tab) to get all the City/Satisfaction counts.

Excel Workbook
ABCDEFGHIJKLMNOPQRS
1Recipt No.Payment typeCustomer's citySale price ($/ton)Delivery time (minutes/ton.km)Customer satisfaction0Count of Customer satisfactionCustomer satisfaction
21EftposSydney3450.572Customer's city2345678Grand Total
32chequeMelbourne4440.323Brisbane112
43EftposBrisbane4340.18Canberra11
54chequeSydney3820.433Melbourne1113
65EftposSydney4120.445Sydney11215
76EftposSydney4510.126Grand Total221311111
87EftposCanberra3580.337
98cashBrisbane3860.672
109cashSydney4070.575
1110credit cardMelbourne3450.635
1211credit cardMelbourne3900.344
Counts
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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