Count data in cells based on criteria

VinodN

New Member
Joined
Aug 31, 2015
Messages
18
Hi,

I am working on an excel wherein there is login and logout mentioned for employees. I am looking out for a formula which will count from row 1 all the time related cells and give me an output. For Eg. In row 2 the Pickup should be 0 and the Drop should be 1 (since there is time on 6/9/17 column for log out). I have mentioned the results required in the subsequent columns.

Request you to please help me with the formula.

Below is the table for your reference.

04-Sep-1705-Sep-1706-Sep-17Formula RequiredResult required
Sr No.NameLog InLog OutLog InLog OutLog InLog OutPickupDropPickupDrop
1AOwn TransportOwn TransportOwn TransportOwn TransportOwn TransportOwn Transport 00
2BLeaveLeaveLeaveLeaveOwn Transport19:00 01
3C10:0019:0010:0019:0010:0019:00 33
4D10:0019:0010:0019:0010:0019:00 33
5E12:3021:3012:3021:3010:0019:00 33
6F12:3021:30Own TransportOwn TransportOwn TransportOwn Transport 11
7G12:3021:30Own TransportOwn TransportOwn TransportOwn Transport 11

<tbody>
</tbody><colgroup><col span="2"><col span="6"><col span="4"></colgroup>
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi Vinod,

Create a small user defined function to do this


Code:
Function CountNonText(ParamArray r()) As Integer
Dim i As Integer
For i = LBound(r) To UBound(r)
If Not WorksheetFunction.IsText(r(i)) Then
CountNonText = CountNonText + 1
End If
Next i
End Function

Then use this formula in Column Formula Required assuming Logins are in column C,E,G

=CountNonText(C4,E4,G4)
 
Upvote 0
Hi,

You can use ISTEXT or ISNUMBER default formulas, same as the VBA coded custom formula
=SUM(ISNUMBER(C4),ISNUMBER(E4),ISNUMBER(G4))

In your example you only have 3 days, but if you have a longer date period you can use this formula for any number of days (for example up to column Z), it will count the timestamps but only in every other column (this is an array formula, add with CTRL+SHIFT+ENTER)

=SUM(ISNUMBER(C4:Z4)*TRANSPOSE(ISODD(ROW(INDIRECT("1:"&COLUMNS(C4:Z4))))))
 
Upvote 0

Forum statistics

Threads
1,216,731
Messages
6,132,391
Members
449,725
Latest member
Enero1

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