How to subtract a named range from a formula

Burrgogi

Active Member
Joined
Nov 3, 2005
Messages
340
Office Version
  1. 2010
Platform
  1. Windows
In a worksheet, I have the following formula:
=COUNTA(A2:A4356)

It tallies up all the items listed in column A. They all contain mostly text values and not numerical values.

There are 2 items that I do not want to be counted in the overall total so I suppose the most obvious way would be to modify the formula to this:
=COUNTA(A2:A4356)-2

Is there be a better way to do so by creating a named range for each of those items? such as "Disregard_1" & "Disregard_2" and then using those named ranges in a formula like the one I'm using above?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Hi

Your stratagy is ok if the two values are always present in column A.
Otherwise something like this:
Excel Formula:
=COUNTA(A2:A4356)-SUM(COUNTIFS(A2:A4356;"{"value1"."value2"}
 
Upvote 0
Hi

Your stratagy is ok if the two values are always present in column A.

Yes, they will always be located in Col. A. After I posted, i was able to figure things out. Here is my formula for now:

=COUNTA(A2:A4356)-COUNTA("Disregard_1")-COUNTA("Disregard_2")

Otherwise something like this:
Excel Formula:
=COUNTA(A2:A4356)-SUM(COUNTIFS(A2:A4356;"{"value1"."value2"}

I think you missed a closing parenthesis at the very end - no? At any rate, I will keep that one in mind for future reference in case I need it. Thanks.
 
Upvote 0
You are right.
Just for sh*ts and giggles, I decided to give your formula a try. I've never seen that before so I wanted to see if it would work for my situation. I tried this:

Code:
=COUNTA(A2:A482)-SUM(COUNTIFS(A2:A482;"{"white"."purple"})

It does not work.
 
Upvote 0
Why?

Mappe1
ABCDE
11028
2xxx2
3xxx
4white
5xxxwhite
6xxxpurple
7purple
8xxx
9xxx
10xxx
11xxx
Tabelle1
Cell Formulas
RangeFormula
C1C1=COUNTA(A2:A11)
E1E1=C1-D1
D1D1=SUM(COUNTIFS(A2:A11,{"white";"purple"}))
D2D2=SUM(COUNTIFS(A2:A11,D5:D6))
 
Upvote 0


Upon reading your latest reply above, I see that you made some typos in the original solution you gave me.

Code:
=COUNTA(A2:A4356)-SUM(COUNTIFS(A2:A4356;"{"value1"."value2"}

1) There should be a comma after COUNTIFS(A2:A4356 You have a semicolon.
2) Between "value1" & "value2", there should be a comma, not a period.
3) You missed 2 closing parenthesis at the very end of the formula.
 
Last edited:
Upvote 0
In my first posting I translated the formula manually. So I missed to change the semicolon into a comma.
But a experienced user should have noticed that.
 
Upvote 0
In my first posting I translated the formula manually. So I missed to change the semicolon into a comma.
You missed much more than just a simple comma. Please see my revised answer above.

But a experienced user should have noticed that.

That is a ridiculous answer. You and I have never interacted on the boards before. How would you know what kind of skill level I have with that formula?
Also if you're going to answer someone's thread, shouldn't you be the one providing an accurate formula that works or at least test it first?
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
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