help with formatting a cell (for TIME, custom format) that retrieves its value from another cell...

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
463
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
In the screen shot below, cell CSM5 calculates (in number of days, hours & then min) an employees time of seniority (from their original date-of-hire until the time of their release of employment.)

The formula in cell CSM5 is: =INT(CSM6-CSM7)&" : "&TEXT(CSM6-CSM7, "h:m")

in the screenshot below, CSM5's (highlighted in yellow) formula returns the value of: 894 days, 9 hours and 35 min.

Cell CSL13 (also in highlighted yellow) gives the value of CSM5 represented as: =CELL("contents", CSM5)


Capture389.JPG


Now we've arrived at my request... I would like the cell adjacent to CSL13 (which is CSM13, highlighted in green) to show the value of CSL13 represented in # of days, hours and min... PLUS 1 MINUTE.

CSL13 = 894: 9:35, and I need CSM13 to equal 894: 9:36

I need this so that I can have my VBA code sort all of the employees on the worksheet by the value represented their tenure when they worked here... the "plus 1 MINUTE" is needed in order to keep all the all the names together after code runs the sort... You see, each employee name (listed in row 1, horizontally) is represented by TWO columns, the column showing their name, column CSL in the example screenshot, as well as the column adjacent to it which is normally hidden... column CSM in my example.

Currently I can sort the worksheet by name or by the date when they left (termination date.) But a need recently arose where I need to be able to sort them by the amount of tenure they obtained while they worked here.


here's the worksheet showing all names sorted alphabetically:
Capture391.JPG

and here's the worksheet showing everyone sorted by their term'd date:
Capture390.JPG

this is just some extra (and unnecessary, actually) information I wanted to add so that what I am requesting hopefully makes sense in the correct context and what fits my particular worksheet needs given with how its laid out... usually someone, & out of a kind gesture to help me, will question why the heck I am doing it this way... lol which very well may still happen, but at least now everyone can see how this particular application functions. (and believe me, I am SURE that I am doing some things in a rather unorthodox manner and may not be the most sufficient or best way to do something.. .and I am always open to hearing suggestions or other alternatives to perform whatever function I may be trying to or am performing here...) so thanks for all/any assistance or help (y)
 

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.
It's difficult to work with CSL13 because it's in text format, so I would instead put this formula in CSM13.
Excel Formula:
=INT(E6-E7) & ":"&TEXT(E6-E7+(1/1440),"h:m")
 
Upvote 1
Solution

Forum statistics

Threads
1,218,027
Messages
6,140,039
Members
450,253
Latest member
MJ Papa

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