Ignoring multiple blank criteria using countifs / sumifs

Exhale2020

New Member
Joined
Sep 30, 2018
Messages
13
Hi all,

I've trawled various forums looking for a solution to this problem without much luck.

My challenge is i'm trying to count a large dynamic range of cells using multiple criteria (4 criteria).

However, what I want to occur is when one (or any/all) of the criteria is blank, I want the formula to ignore that particular criteria (not search for 'blank' as it does now).

SeasonFW18
GenderMENS
DivisionCottons
BrandUnitsCC's
Oasissumifscountifs
Gapsumifscountifs
ZARAsumifscountifs
H&Msumifscountifs

<tbody>
</tbody>

In the above table, 'Brand', 'Season', 'Gender', 'Division'. Are all Criteria. If any or all of the criteria are blank, I want it to be ignored.
The brand list will be dynamic and changes regularly. The Season, Gender & Division will be treated as drop down menus which are dynamic.

The purpose is to return a count in the CC's column.


The table being searched looks like this:

SeasonGenderDivisionBrandItem NumberColourTotal
FW18MensBottomsH&Mxxx123black12
SS19WOMENSTOPSH&MXX1234WHITE4
FW18MENSCOTTONSZARAXXX22BLUE7
FW18MENSTOPSOASIS12342WHITE8
SS18MENSTOPSZARA56WHY2BLUE8
FW18MENSCOTTONSOASIS44HT53BLACK9
SS18WOMENSTOPSZARAXX1244BLUE10
FW18MENSTEESOASIS134GGORANGE12
FW18WOMENSCOTTONSZARAGHR381BLACK5

<tbody>
</tbody>

The field to count is 'Total'


I've tried a combination of Ifs and CountIFS to ignore when blank, but its extremely lengthy and most likely inefficient. The source data is up to 20,000 rows :eek:


I'd also like to do the same with a Sumifs formula.


All help is much appreciated!

Thanks
G

Version: Office 2013
PC
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
It's better to post the expected results instead of suggesting/forwarding the type of formulas the would-be helpers must devise.

What are CC's and Units, that is, which values must be addressed in the data (Season, Gender, Division, Brand, Item Number, Colour, or Total)?
 
Upvote 0
It's better to post the expected results instead of suggesting/forwarding the type of formulas the would-be helpers must devise.

What are CC's and Units, that is, which values must be addressed in the data (Season, Gender, Division, Brand, Item Number, Colour, or Total)?

Thanks for the reply aladin. I'd upload the actual table but it's not letting me.

Let me try to articulate..

The purpose of the table is to summarize the instances where any of the criteria occurs. Let's focus on just counting as opposed to SUM.

CC's = count of the number of times the combination of any of the criteria occurs in the source data (referencing Total highlighted red).
In this case Season, Gender, Division, Brand (highlighted green). A simple countIFS formula would work, but fails when any of the criteria is blank.

For example, when I leave 'Season' blank, I'd like to return results only for the other criteria.

Hope this is clearer.
 
Upvote 0
Sorry. What I'm trying to convey is that when you seek help, you should not suggest/forward a type of formula as solution.
Rather: describe the problem and let the helper decide on the Excel formula.

What do you want to sum from the table under Units and what do you want to count from the table under CC's? Please do not repeat the issue of blanks as it's clear what that means.
 
Upvote 0
Sorry. What I'm trying to convey is that when you seek help, you should not suggest/forward a type of formula as solution.
Rather: describe the problem and let the helper decide on the Excel formula.

What do you want to sum from the table under Units and what do you want to count from the table under CC's? Please do not repeat the issue of blanks as it's clear what that means.

For Units = I'm trying to sum the 'Total' column in red
For Count = I'm trying count the 'Total' column in red
 
Upvote 0

Book1
ABC
1SeasonFW18
2GenderMENS
3DivisionCottons
4
5
6BrandUnitsCC's
7Oasis91
8Gap00
9ZARA00
10H&M00
Sheet1


In B7 enter and copy down:

=SUMPRODUCT(SUMIFS(total,brand,A7,season,IF(B1="",season,B1),gender,IF(B2="",gender,B2),division,IF(B3="",division,B3)))

In C7 enter and copy down:

=SUMPRODUCT(COUNTIFS(brand,A7,season,IF(B1="",season,B1),gender,IF(B2="",gender,B2),division,IF(B3="",division,B3)))
 
Upvote 0
Thanks Aladin, the formula works.

However, it's extremely resource heavy and pretty much times out when copied over a few cells.

Do you have any alternative ideas?

Thanks again!
 
Upvote 0
Thanks Aladin, the formula works.

However, it's extremely resource heavy and pretty much times out when copied over a few cells.

Do you have any alternative ideas?

Thanks again!

1. Do not refer to whole columns.

2. Do the following better?

=SUMIFS(total,brand,A7,season,IF(B1="","?*",B1),gender,IF(B2="","?*",B2),division,IF(B3="","?*",B3))

=COUNTIFS(brand,A7,season,IF(B1="","?*",B1),gender,IF(B2="","?*",B2),division,IF(B3="","?*",B3))
 
Upvote 0
1. Do not refer to whole columns.

2. Do the following better?

=SUMIFS(total,brand,A7,season,IF(B1="","?*",B1),gender,IF(B2="","?*",B2),division,IF(B3="","?*",B3))

=COUNTIFS(brand,A7,season,IF(B1="","?*",B1),gender,IF(B2="","?*",B2),division,IF(B3="","?*",B3))

Aladin.. you're a star! Massively quicker.


I've also tried reducing the range to a limited selection but I'm getting VALUE! error.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,053
Latest member
Mesh

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