VA code to get the data horizontally along with some calculations

Balajibenz

Board Regular
Joined
Nov 18, 2020
Messages
80
Office Version
  1. 2013
Platform
  1. Windows
Hi Team,

I have input sheet with employees time entries.

It has the columns as Company, ID, Name and time entries which are aligned date wise and total break time for each employee in below format.

In/out time would be recorded each and every time when an employee swipes the card for in or out. Break time is total break time for the day.

CompanyIDNameDateIn/Out TimeBreak Time
Solid2967Ritz, Vivian31.01.2213:09
0.5​
Solid2967Ritz, Vivian31.01.2216:06
0.5​
Solid2967Ritz, Vivian31.01.2216:11
0.5​
Solid2967Ritz, Vivian31.01.2221:58
0.5​
Studitemps1354Solihin, Martin Chr.02.02.2207:26
0.88​
Studitemps1354Solihin, Martin Chr.02.02.2213:18
0.88​
Studitemps1354Solihin, Martin Chr.02.02.2214:11
0.88​
Studitemps1354Solihin, Martin Chr.02.02.2216:48
0.88​

what i am looking for is the output in the below format where we are having single line of data and respective dates data should be places under it accordingly. If an employee doesn't have date for any particular date we can it as blank or 0 in the respective fields.

Start TimeEnd TimeTotal Working HoursTotal BreakActual Working HoursStart TimeEnd TimeTotal Working HoursTotal BreakActual Working Hours
CompanyIDName31-01-2022
01-02-2022
Solid2967Ritz, Vivian13:0921:58
8.82​
0.5​
8.32​
00:00​
00:00​
0.0​
0.0​
0.0​
Studitemps1354Solihin, Martin Chr.
00:00​
00:00​
0.0​
0.0​
0.0​
07:2616:48
9.37​
0.88​
8.48​

Date column will should be merged for all the 5 data.

Start Time = Least in/out time from the source
End Time = Highest in/out time from the source
Total Working Hrs = =( End Time - Start Time)*24
Break Time = Break Time from the source
Actual Working Hrs = Total Working Hrs - Break Time

This out put should be created as separate worksheet in the same workbook.

Note: Source will have weekly data so it typically has dats for 5 working days. Would be great if at all there is way to do it using arrays or any other formulas rather than VBA code.

Thank you in advance.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,815
Messages
6,181,135
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