COUNTIF for Increasing Column

sk2018

New Member
Joined
Jul 7, 2018
Messages
26
Office Version
  1. 2016
Platform
  1. Windows
ABCDE
1AppleOrangeKiwiResponse 1Response 2
2=countif(D2:E2, "Apple")
=countif(D2:E2,"Orange")=countif(D2:E2,"Kiwi")AppleKiwi
3

<tbody>
</tbody>

Do refer to the above for your understanding.

Given that as time goes by, I will have data add on Column F, G, H, I and etc onwards.
Is there any way for me to count the number of Apple, Orange, Kiwi starting from Column D onwards.


I do not want to set it as Table as I have plenty of worksheets and need to distribute to others to use.
I'm not considering of using the range of D2:Z2 or whichever wide range as to avoid any deletion of columns that may take place.

Is there any formula that will be able to detect the last notblank columns and make it as the range?


Thanks.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
=COUNTIFS($D2:INDEX($2:2,MATCH(REPT("z",255),$2:2)),"apple")

will count all apple occurrences from D2 on.


Further question on this.
The example that I gave is on 3 items: Apple, Orange, Kiwi.

Now I'm increasing the items to 5: Apple, Orange, Kiwi, Grapes, Cherries.
However I faced circular reference problem for Grapes (4th Item) and Cherries (5th Item).

Does that formula you proposed has a limitation to be used only on 3 items?

Thanks
 
Upvote 0
No limitation.

Would you post the data you have? (Do not post any formula though, just the expected results.)
 
Upvote 0
No limitation.

Would you post the data you have? (Do not post any formula though, just the expected results.)


LMNOPQRSTU
1TotalAppleOrangeKiwiGrapesCherriesSample PicklistResponse 1Response 2Response 3
2 Formulau can ignore this=COUNTIFS($S2:INDEX($2:2, MATCH(REPT("z",255),$2:2)),"Apple")=COUNTIFS($S2:INDEX($2:2, MATCH(REPT("z",255),$2:2)),"Orange")=COUNTIFS($S2:INDEX($2:2, MATCH(REPT("z",255),$2:2)),"Kiwi")=COUNTIFS($S2:INDEX($2:2, MATCH(REPT("z",255),$2:2)),"Grapes")=COUNTIFS($S2:INDEX($2:2, MATCH(REPT("z",255),$2:2)),"Cherries")<this is="" the="" picklist="" values="" of="" all="" 5="" items,="" not="" to="" be="" counted="">
</this>
AppleCherriesKiwi
2 Valueu can ignore this111

<tbody>
</tbody>

Any problem with my formula?
Coz I;m having problem with circular reference specifically at P2

Column R - I have set a list of picklist value using Data Validation that consists of Apple, Orange, Kiwi, Grapes, Cherries. This serves mainly as a reference. And it should not be counted as part of the Column M to Column Q
 
Last edited:
Upvote 0
In M2 enter and copy across to Q2...

=COUNTIFS($S2:INDEX($S2:$XFD2,MATCH(REPT("z",255),$S2:$XFD2)),M$1)


Awesome!!!
you solve the problem which I had been trying for the whole day!!!!!!!!!

Thanks a lot!!!
 
Upvote 0
You could use this method;


MNOPQRSTU
1AppleOrangeKiwiGrapesCherriesSample PicklistResponse 1Response 2Response 3
210101AppleCherriesKiwi

<tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
M2=SUMPRODUCT(--(COUNTIF(responses,M$1)))
N2=SUMPRODUCT(--(COUNTIF(responses,N$1)))
O2=SUMPRODUCT(--(COUNTIF(responses,O$1)))
P2=SUMPRODUCT(--(COUNTIF(responses,P$1)))
Q2=SUMPRODUCT(--(COUNTIF(responses,Q$1)))

<tbody>
</tbody>

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
responses=OFFSET(Sheet1!$S$2,,,,COUNTIF(Sheet1!$S$2:$XFD$2,"?*"))

<tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0

Forum statistics

Threads
1,215,676
Messages
6,126,170
Members
449,296
Latest member
tinneytwin

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