VBA: Extract minutes and hours to give an integer and decimal for cost calculation

Animalised

New Member
Joined
Apr 24, 2016
Messages
31
Hi Everyone,

I'm trying to speed up a process that is monotonous and unnecessary.

This may get long, so I apologise in advance. (I'm wrapping my head around this slowly).


I've managed to delete rows if a value = zero.

What I now need to do is delete a row if the Time Value in a cell is less than 00:06:00, I then need to check the entire column for the same reason.

(I will find out how to delete columns as that is the next stage, a little research)

Once rows with a cell value less than 00:06:00 have been deleted I need to extract the minutes of the time stated (i.e. 04:45:25, I need to pull "45" from that information and put it into a cell next to the 04:45:25 cell)

(I divide the minutes pulled by 60 to give me a decimal value that is added to the hours(4) stated "4", giving "4.75" to calculate cost)

So, like the minutes, I need to extract Hours and add those hours to the decimal minutes value from earlier.


If anyone is able to help with this, i would be more than thankful!

Thankyou again, and apologies that this is long!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi

Not clear to me.

You mean that given

04:45:25

you will first discard the seconds

04:45:00

and then convert to decimal hours

4.75

?

What if it were

04:45:50

would you still consider

04:45:00

or, since it's closer

04:46:00

?

Also, would it not be OK to simple convert the time you have

04:45:25

to decimal hours?
 
Upvote 0

Forum statistics

Threads
1,223,083
Messages
6,170,037
Members
452,296
Latest member
chueeee

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