VBA for time calculation

Sods Law

New Member
Joined
Jun 30, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Good morning,

I've been using MrExcel for ove a year, it's always managed to awnser questions in some form or another.

This one has me stumped I need to subtract the time between finished time and started to get total time taken. I know how to do the =H2-H1, but the table is going to be rather long so doing this manually will take a lot of time.
I'm not going to be the end user so being able to press a button and have it automatically do this would be a great help.

A little info about the excel sheet, I have created it using power query and a pivot table to get a usable end result. I have attached an image that can sa a thousand words :)

Thanks in advanced for any help. Apologies if I have not provided enough information.
 

Attachments

  • Time Check.JPG
    Time Check.JPG
    225.6 KB · Views: 7

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.
I forgot to say, I think it would be easier if it was a button that when clicked it asked for first cell reference and then second cell reference and then subtracted the selected cell values.

Sorry I have no code at he moment to post, as I am drawing a blank on how to start this one.
 
Upvote 0
Index.JPG

Good afternoon,

I have been editing the above for a littel while and believe I may have an easier solution, I just don't now how to filter the index column to keep the min and max values.

I would like to keep the 1's and then the highest value for each reference in column A.

any help would be greatly appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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