Counting Cells based on 2 different criteria

camelrunner

New Member
Joined
Sep 9, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I need to count the number of non-blank cells in an array that do not contain the text "Neg". The cells in the array are merged and each cell contains a formula, so while they are blank (they have no visible value) they still contain a formula. The formula I have so far =SUMIFS(B18:M25,B18:M25,SUM(--(TRIM(B18:M25)<>"")),B18:M25,"<>*Neg*"), gives me 0 when it should be 2 based on some testing.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Which cells are merged?

Can you show us some sample data and your expected result?

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Maybe
Excel Formula:
=COUNTIFS(B18:M25,"<>",B18:M25,"<>*Neg*")
 
Upvote 0
Maybe
Excel Formula:
=COUNTIFS(B18:M25,"<>",B18:M25,"<>*Neg*")
This counts the cells that are blank as well. It works for not counting the Negs, but the blanks are still counted. The blank cells contain a formula that will appear empty if there is no input for that cell, so excel sees the blanks as containing a value due to the formula
 
Upvote 0
This counts the cells that are blank as well. It works for not counting the Negs, but the blanks are still counted. The blank cells contain a formula that will appear empty if there is no input for that cell, so excel sees the blanks as containing a value due to the formula
Can you post what these formulas look like exactly, so we can see what they might be returning?
These details are important, which is why I asked to see a sampling of your data.
All blanks are not created equal (and a "space" is NOT the same as a blank).
 
Upvote 0
Try this formula:
Excel Formula:
=SUM((B18:M25 > 0) * ISNUMBER(FIND("Neg", B18:M25)))
 
Upvote 0

Forum statistics

Threads
1,225,204
Messages
6,183,573
Members
453,170
Latest member
sameer98

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