Sum.if that will not result in "0" when there is no data that complies with the set conditions.

isafloor

New Member
Joined
Feb 3, 2015
Messages
37
Office Version
  1. 2007
Hello.

I want to create a spreadsheet for our farm that will help monitoring absentee workers (there is a lot of absenteeism in agriculture).

The "Data table" has the raw data collected every week:
1. As you can see, Kate was present in week 50 (202050) but didn't come to work any day in week 51 (202051).

I would like to create a formula so that when I have the accumulated info per week, in week 51 it will return "blank" for Kate, instead of "0". "0" as data would actually mean that the person came to work every day, not that they didn't come all week. You can see the "Summary table" for this.

The formula I am using in B4 of the "Summary table" returns "0" when there is no actual data. I would like it to stay blank, or to have the option of putting a text like "n/a" (not applicable).

In B4 of the "Summary table" I am using: =(SUMIFS('Data table'!$C:$C,'Data table'!$A:$A,B$3,'Data table'!$B:$B,$A3)

Thanks, and happy holidays!

Summary table
Employee202051202050
John20
Mary45
KateSHOULD BE BLANK, OR OPTIONALLY SAY "N/A"1



Data table
Week number (YYYYWW)EmployeeAbsences
202050John0
202050Mary5
202050Kate1
202051John2
202051Mary4
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
I suggest that you update your Account details (click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=IFERROR(1/(1/SUMIFS('Data table'!$C:$C,'Data table'!$A:$A,B$3,'Data table'!$B:$B,$A3)),"n/a")
 

isafloor

New Member
Joined
Feb 3, 2015
Messages
37
Office Version
  1. 2007
Hi I just updated the info to say that I use Excel 2007, thanks for pointing it out.

The formula works except that I have the same problem but the other way around: when somebody comes every day (and has "0" as "abscences"), I get the same "n/a" when somebody doesn't come any day.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
Thanks for updating your profile.

How about
Excel Formula:
=IF(COUNTIFS('Data table'!$A:$A,B$3,'Data table'!$B:$B,$A3)=0,"n/a",SUMIFS('Data table'!$C:$C,'Data table'!$A:$A,B$3,'Data table'!$B:$B,$A3))
 
Solution

isafloor

New Member
Joined
Feb 3, 2015
Messages
37
Office Version
  1. 2007

ADVERTISEMENT

Worked like a charm, thank you my friend! Greetings from Culiacan!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

isafloor

New Member
Joined
Feb 3, 2015
Messages
37
Office Version
  1. 2007

ADVERTISEMENT

Hi, I had a different problem, I don't know if I should post it as a different thread, but here goes.

I have the data set as "a table" where you have filters in the headers. I don't know how this function is translated into Excel English from Spanish, but basically you can choose a table and "set it as a table" with a format where each row has alternating colours and in the header you have filters that you can press and sort A-Z or 0-9999, etc.

However, when I use the filter for any particular week, so I can see how has more absent days lumped together, the filter has many "6" lumped together but then there are some that are not in order, of any number, I might have a "5" in the middle of "0"s for example.

Why is this happening?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,856
Office Version
  1. 365
Platform
  1. Windows
Without being able to see the actual data it's difficult to tell, but if the Absences has been sorted one possible reason is that some of your values are text & some are numbers.
However as this is a totally different question, you will need to start a new thread if you need further help.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,125
Messages
5,640,266
Members
417,132
Latest member
Srw123

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
Top