VBA code to align text horizontally in a single line

Rajguru

New Member
Joined
Feb 16, 2022
Messages
1
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:090.5
Solid2967Ritz, Vivian31.01.2216:060.5
Solid2967Ritz, Vivian31.01.2216:110.5
Solid2967Ritz, Vivian31.01.2221:580.5
Studitemps1354Solihin, Martin Chr.02.02.2207:260.88
Studitemps1354Solihin, Martin Chr.02.02.2213:180.88
Studitemps1354Solihin, Martin Chr.02.02.2214:110.88
Studitemps1354Solihin, Martin Chr.02.02.2216:480.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-202201-02-2022
Solid2967Ritz, Vivian13:0921:588.820.58.3200:0000:000.00.00.0
Studitemps1354Solihin, Martin Chr.00:0000:000.00.00.007:2616:489.370.888.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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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