Absent dates need in Attendance Sheet..

serona72112

New Member
Joined
Apr 27, 2017
Messages
1
I need absent dates in Attendance Sheet.. How to do?

Emp. code12345678absent date
Emp. 001PPAPPAPP????
Emp. 002APPPPPAA????

<tbody>
</tbody>

answer must be,

Emp. 001 = 3, 6

Emp. 002 = 1, 7, 8

Help me !

Regards,
Serona
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Welcome to the Board!

I would probably create my own Function using VBA to do this.
Would that be an acceptable solution for you?
 
Upvote 0
So here is that that UDF would look like:
Code:
Function AbsentDays(myRange As Range, myRow As Long) As String

    Dim cell As Range
    Dim myString As String
    
'   Loop through all the cells in the range
    For Each cell In myRange
'       Check for value
        If cell = "A" Then
            myString = myString & Cells(myRow, cell.Column) & ", "
        End If
    Next cell
    
'   Return string
    If Len(myString) > 0 Then
        AbsentDays = Left(myString, Len(myString) - 2)
    End If
    
End Function
Then you would use it like any other function in Excel.
So, let's say that your data example is in the range A1:J3, so that your first row of data is on row 2 and the Ps and As are in range B2:I2 and row 1 has the day numbers.

Then, here is the formula to put in J2:
Code:
=absentdays(B2:I2,1)
 
Upvote 0
Thank you so much I am so great full to you I can't thank you enough I just made this account to thank you.

Your formula Runs Perfectly But It Show Full Dates Like "02-03-2022" but instead I only want The Day Value Like "2,1, 7, 8"
again Thank you so much for your formula.
 

Attachments

  • Untitled.png
    Untitled.png
    4.2 KB · Views: 12
Upvote 0
Welcome to the Board!

Your formula Runs Perfectly But It Show Full Dates Like "02-03-2022" but instead I only want The Day Value Like "2,1, 7, 8"
again Thank you so much for your formula.

If that is the case, then you do not have the same conditions as what the original poster posted.
Note that the first row, they just have plan numbers, like 1,2,3,...

While yours appears to have that, I suspect that is really not the case. I suspect that your first row is really not numbers like that, but rather you have dates with a custom format of "d".
That is the only way my code would be returning dates instead of those numbers.

If that is the case, and you only want to return the day number of your date, then you will need to change this line of code:
VBA Code:
            myString = myString & Cells(myRow, cell.Column) & ", "
to this:
VBA Code:
            myString = myString & Format(Cells(myRow, cell.Column), "d") & ", "
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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