Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 26
Default Formula to subtract values in one cell only...

sorry duplicate post.

Last edited by neilcarden : November 1st 06 at 12:33 PM
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Formula to subtract values in one cell only...

On Wed, 1 Nov 2006 12:14:59 +0000, neilcarden
wrote:


Hi

If I have a cell that contains '09:00-17:30' - is there a formula or
way I can get the amount of hours worked into another cell without
using text to columns to seperate the values and work it out that way?

Thanks in advance
Neil


If the format is exactly as you describe, then:

=LEFT(RIGHT(A1,6),5)-RIGHT(LEFT(A1,6),5)

Format the result as h:mm

OR, if you want just the number of hours, so as to be useful in a salary
calculation, use:

=24*(LEFT(RIGHT(A1,6),5)-RIGHT(LEFT(A1,6),5))

and format as General or as Number with the required number of decimal places.


--ron
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Formula to subtract values in one cell only...

On Wed, 01 Nov 2006 08:02:22 -0500, Ron Rosenfeld
wrote:

On Wed, 1 Nov 2006 12:14:59 +0000, neilcarden
wrote:


Hi

If I have a cell that contains '09:00-17:30' - is there a formula or
way I can get the amount of hours worked into another cell without
using text to columns to seperate the values and work it out that way?

Thanks in advance
Neil


If the format is exactly as you describe, then:

=LEFT(RIGHT(A1,6),5)-RIGHT(LEFT(A1,6),5)

Format the result as h:mm

OR, if you want just the number of hours, so as to be useful in a salary
calculation, use:

=24*(LEFT(RIGHT(A1,6),5)-RIGHT(LEFT(A1,6),5))

and format as General or as Number with the required number of decimal places.


--ron



The basic formula could be written also as:

=MID(A1,8,5)-MID(A1,2,5) or

=24*(MID(A1,8,5)-MID(A1,2,5))


--ron
  #4   Report Post  
Junior Member
 
Posts: 26
Default

Thanks guys!!! all are great...

Save's me a days work now!!!

Cheers
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 618
Default Formula to subtract values in one cell only...

=MID(A1,8,5)-MID(A1,2,5)
Format as [h]:mm
--
David Biddulph

"neilcarden" wrote in message
...

Hi

If I have a cell that contains '09:00-17:30' - is there a formula or
way I can get the amount of hours worked into another cell without
using text to columns to seperate the values and work it out that way?

Thanks in advance
Neil





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use vlook to show the value of a cell using a formula David Excel Discussion (Misc queries) 5 October 21st 06 12:01 AM
I Need a formula to evaluate a cell with + or - values Bob in Oklahoma Excel Worksheet Functions 6 October 31st 05 02:41 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Formula checking multiple worksheets sonic-the-mouse Excel Worksheet Functions 2 June 5th 05 07:48 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 10:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"