consolidate date time in cells

FROGGER24

Well-known Member
Joined
May 22, 2004
Messages
704
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
I am working on a spreadsheet and need to consolidate the date and time in column B, once the date and time have been merged into one cell the delete rows where the cell in A is blank. this will need to be able to run on various lengths of rows. thank you

camin cargo.xlsx
AB
3Expected ResultsDate/Time
43/26/2021
53/26/21 1:301:30:10
63/26/21 1:291:29:50
7
83/26/21 1:281:28:13
93/25/2021
103/25/21 4:114:11:07
113/25/21 4:044:04:00
123/25/21 4:034:03:04
133/25/21 5:155:15:12
143/24/20
153/24/20 9:259:25:38
163/24/20 8:598:59:22
173/24/20 8:588:58:34
183/24/20 8:278:27:43
page 2
Cell Formulas
RangeFormula
A8,A5:A6A5=$B$4+B5
A10:A13A10=$B$9+B10
A15:A18A15=$B$14+B15
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I found a solution, with the use of helper columns

<
Range("AD4:AD" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = "=IF(RC[-28]="""",RC[-29],"""")"
Range("AD4:AD" & Cells(Rows.Count, 1).End(xlUp).Row).Value = Range("AD4:AD" & Cells(Rows.Count, 1).End(xlUp).Row).Value


Range("AD4:AD" & Cells(Rows.Count, 1).End(xlUp).Row).Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=R[-1]C"
Selection.NumberFormat = "m/d/yy h:mm;@"

Range("AE5:AE" & Cells(Rows.Count, 1).End(xlUp).Row).Value = Range("A5:A" & Cells(Rows.Count, 1).End(xlUp).Row).Value
Range("AE5:AE" & Cells(Rows.Count, 30).End(xlUp).Row).Replace What:="AM", Replacement:=""
Range("AE5:AE" & Cells(Rows.Count, 30).End(xlUp).Row).Replace What:="PM", Replacement:=""

Range("AF5:AF" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = "=RC[-2]+RC[-1]"
Range("AF5:AF" & Cells(Rows.Count, 1).End(xlUp).Row).Value = Range("AF5:AF" & Cells(Rows.Count, 1).End(xlUp).Row).Value>

Any ways to make more efficient?
 
Upvote 0
Solution

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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