Can I use a Dropdown box with a COUNTIF formula?

Muller

New Member
Joined
Jan 20, 2009
Messages
7
Hello folks,


I am trying to write a formula where if I select a value from a dropdown the numbers that are entered below will be counted or not counted, depending on the option selected.

In my drop-down menu, I have two options: A or F. I want it to work so that the row below cells where the drop downs are only active and count the numbers dependant on what option is selected

For Example:

A1 to Z1 are dropdowns
A2 to Z2 are where the numbers below are entered

I only want to count the numbers entered into the sheet that have A selected from the drop-down list above the cell where the number is entered. So if there is a numerical entry in row A2 with an A selected from the drop down, I want it to be counted. If there is a numerical entry on Row A2 with an F above it, I don’t want the number counting.

I think I need a COUNTIF formula of some description, but I'm not sure how to write this. Any help I can get here would be greatly appreciated.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
=countifs(A1:Z1,"A",A2:Z2,">"&0)
that will count the numeric values with an A in the dropdown

if i understand correctly
in the example 3 - as 1 value with an A is blank
but maybe it may have zero
=COUNTIFS(A1:Z1,"A",A2:Z2,"<>")


Book2
ABCDEFG
1afaffaa
212123234345456678
3
4count = a3
Sheet1
Cell Formulas
RangeFormula
B4B4=COUNTIFS(A1:Z1,"A",A2:Z2,">"&0)


Book2
ABCDEFGHI
1afaffaaa
2121232343454566780
3
4count = a4
5
Sheet1
Cell Formulas
RangeFormula
B4B4=COUNTIFS(A1:Z1,"A",A2:Z2,"<>")
 
Upvote 0
Solution
you are welcome
note the 1st example will not count any entries with a zero
 
Upvote 0
After ding some experimenting with the form I was working on using the solution provided that I said worked, it doesn't quite do what I need it to. So...I think I may have put a bad explanation in for what I wanted!

Here is an example of how I would like the sheet to work:

AAAFFAFAAFTotal
1425732646
20​

I need it to work so that if A is selected on the row above the numbers, then the value entered underneath the A gets counted in a total column at the end of the row.

Is this possible at all?
 
Upvote 0
so not count, but sum the numbers
=SUMIF(A1:J1,"A",A2:J2)

Book2
ABCDEFGHIJKL
1AAAFFAFAAFTotal
2142573264620
Sheet1
Cell Formulas
RangeFormula
L2L2=SUMIF(A1:J1,"A",A2:J2)
 
Upvote 0
Thank you! I have not heard of SUMIF formulas before. I will give this a try jn the morning!
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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