Countif Headache

VBA learner ITG

Active Member
Joined
Apr 18, 2017
Messages
272
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi all,

This should be something easy to sort.

But I have gone formula crazy after staring at the screen for so long i cannot figure out why my formula is not outputting correctly,

I have done everything in terms of recreating a new formula, google search and now i need your expertise if possible.

As you can see from the link to the spreadsheet the Countif should be creating a sequence number for all grouped values but for some reason its restarting after it hits 27 in the number sequence.

Any ideas to why this would be?

File In question
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Which row is it failing on?
Also your formula can simply be written as
Excel Formula:
=COUNTIF($A$2:A2,A2)
 
Upvote 0
Which row is it failing on?
Also your formula can simply be written as
Excel Formula:
=COUNTIF($A$2:A2,A2)
Hi Fluff,

That was my original starting formula.

As I need to add some variables to the grouping value thats why i have written it in the way i have. If you look at cell A98 shows 27 and then on A98 restarts from 1 when it should be 28 in count-if value sequence because i declared that these values should be together: GROCERYCERTASSCOTLANDCERTAS LICENSEDCERTASSCOTLANDCERTAS FRESHFROZENCERTASSCOTLANDCERTAS
 
Upvote 0
Not sure if I understand, but is this what you are trying to do
Excel Formula:
=IF(COUNTIFS(scotland,A2),SUM(COUNTIFS(A$2:A2,scotland)),IF(COUNTIFS(wales,A2),SUM(COUNTIFS(A$2:A2,wales)),IF(COUNTIFS(england,A2),SUM(COUNTIFS(A$2:A2,england)),COUNTIFS(A$2:A2,A2))))
 
Upvote 0
Solution
Which row is it failing on?
Also your formula can simply be written as
Excel Formula:
=COUNTIF($A$2:A2,A2)
Hi Fluff,

So I declared that any instances of these groups should be Countif together:

Countif to include all instances of these values:
GROCERYCERTASSCOTLANDCERTAS
LICENSEDCERTASSCOTLANDCERTAS
FRESHFROZENCERTASSCOTLANDCERTAS

Countif to include all instances of these values:
GROCERYCERTASENGLANDCERTAS
LICENSEDCERTASENGLANDCERTAS
FRESHFROZENCERTASENGLANDCERTAS

Countif to include all instances of these values:
GROCERYCERTASWALESCERTAS
LICENSEDCERTASWALESCERTAS
FRESHFROZENCERTASWALESCERTAS

Any-other value in column A can be treated with the normal CountIF formula
 
Upvote 0
Not sure if I understand, but is this what you are trying to do
Excel Formula:
=IF(COUNTIFS(scotland,A2),SUM(COUNTIFS(A$2:A2,scotland)),IF(COUNTIFS(wales,A2),SUM(COUNTIFS(A$2:A2,wales)),IF(COUNTIFS(england,A2),SUM(COUNTIFS(A$2:A2,england)),COUNTIFS(A$2:A2,A2))))
Hi fluff,

Thanks you as always. It works as expected. I cant thank you enough for your time.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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