Counting formula question

apontiff

New Member
Joined
Jul 28, 2011
Messages
4
I have a report that tracks the days that our employees work in different districts (represented by district codes). I have one tab for each month of the year. On each tab, the columns represent the days of the month and the rows represent ech employee. What I am trying to do is have a formula at the end of each row that will calculate how many days that person worked, regardless of the actual text in the cell. How would I do that.

**I am using excel 2003, not sure if that makes a difference.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Welcome to the board!

Excuse me if I have misunderstood your requirement.
If you intend to count Non-Blank cells in the date columns for each employee then you should use:
=COUNTA(B2:AF2)
 
Upvote 0
Well, some cells are blank and some are not. I am basically trying to get it to show at the end of the row how many cells have data in them.

For example, if there are 31 columns and i'm showing that this person worked from January 7 thru January 31, I want the the end of the row to show "25".
 
Upvote 0
Did you try above formula then? It should work!
Adjust formula to suit your date columns!
 
Upvote 0
Well, some cells are blank and some are not. I am basically trying to get it to show at the end of the row how many cells have data in them.

For example, if there are 31 columns and i'm showing that this person worked from January 7 thru January 31, I want the the end of the row to show "25".

Maybe the DATEDIF function? Where A2=January 7 and B2=January 31

Code:
=DATEDIF(A2,B2,"D")

That gives me 24, so you may need to add "+1" outside the parentheses like this:

Code:
=DATEDIF(A2,B2,"D")+1
 
Upvote 0
OK, now I'm going to go a step further...

When an employee is identified as being in a certain district, the cell is shaded based on if he is traveling, working on land, working offshore, training, etc.

Is there a way that I can have a formula that takes the sum of the formula I just created and subtract cells shaded in a particular color?

For example, John Smith worked in ditrict 20 from January 7 thru January 31. January 7 and 8 cells are shaded in red because he travelled and the other cells are shaded in green because he worked. From my other formula, I show that he was coded to district 20 for 23 days. I want the worksheet to automatically calculate out of 23 days, 21 of those were actual working days.

Is this possible?
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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