Help please - count cells in row with values but ignore certain words

TrickyTrunk

New Member
Joined
May 10, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi all

I have searched on here and generally but can't find an answer to this. I am a beginner to Excel.

I am developing a work allocation spreadsheet that doubles as an annual leave diary. It will look something like this.

Employee NameTotal allocation1st May2nd May3rd May
John Smith1A/L12XX12345DUTY

The 12XX1245 would be a reference number of the work that has been allocated on that day. A/L would mean that person is on leave. DUTY is a particular task that will also be listed on there.

Work would not be allocated the same day as leave (A/L) or DUTY. So if work is not allocated, the cell will be blank. So in example above, only one allocation has been made hence it's 1.

I want the Total Allocation column to count the number of allocated pieces of work. So far I have been using a forumla to count the cells in the row that has an entry but excluding cells with "A/L" but this means the formula is counting DUTY and I do not want that. I don't know how to exclude both A/L and DUTY though. My current formula:

=COUNTA(D9:AH9) - SUMPRODUCT(COUNTIF(D9:AH9,"A/L"))
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I managed to post that before finishing it. D9:AH9 is an example of the range of rows. I think it says what else it needs to - other than thank you very much in advance.
 
Upvote 0
you could just add
=COUNTA(D9:AH9) - SUMPRODUCT(COUNTIF(D9:AH9,"A/L") - SUMPRODUCT(COUNTIF(D9:AH9,"DUTY"))

as a quick suggestion
a few other ways are possible
but will think about a shorter version
 
Upvote 0
I thought that might work but i've tried it and it just doesn't seem to work for me. It seems to then count every entry, even A/L or DUTY. I might be doing something wrong though.
 
Upvote 0
If your reference numbers always begin with a number try
Excel Formula:
=COUNT(FILTER(COLUMN(D9:AH9),ISNUMBER(LEFT(D9:AH9)+0)))
other wise
Excel Formula:
=COUNT(FILTER(COLUMN(D9:AH9),(D9:AH9<>"")*(D9:AH9<>"A/L")*(D9:AH9<>"Duty")))
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,116
Members
453,021
Latest member
Justyna P

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