LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default complex time formula

Thanks Tom that helps hugely. I appreciate you taking time to help us
newbies especially with something as simple as the difference in
division.

Cheers

James


Tom Ogilvy wrote:
Dim cell As Range

For Each cell In Selection.Columns(1).Cells
With cell
if isnumeric(.Value) then
.Value = ((.Value \ 100) + (.Value - _
(.Value \ 100) * 100) / 60) / 24
.NumberFormat = "h:mm AM/PM"
End if
End With
Next cell

/ this is normal division
\ this is integer division

demo'd from the immediate window:


? 7 / 3
2.33333333333333
? 7 \ 3
2

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Bob et al,

A couple more questions to help my ignorance:

1.) In the spreadsheet I have columns which include one of two
possible text strings: BKD or ANR. I need to leave them without
changing them. The macro you have helped me with gets stuck when it
encounters text. How do I get the macro to differentiate between text
and integers? And how do I get it to ignore the text?

2.) what is the difference between using the '\' and '/' in this line:
.Value = ((.Value \ 100) + (.Value - (.Value \ 100) * 100) / 60)
/ 24


Cheers and thanks again.

James

wrote:
Thanks Bob - now I understand the offset. Brilliant - thank you again.

James

Bob Phillips wrote:
Dim cell As Range

For Each cell In Selection.Columns(1).Cells
With cell
.Value = ((.Value \ 100) + (.Value - (.Value \ 100) * 100)
/ 60)
/ 24
.NumberFormat = "h:mm AM/PM"
End With
Next cell



--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
ps.com...
Thanks Bob for the macro. It has been interesting working through
what you have done with it as this is the first time I am working
with
VBA.

Is it possible to get the macro to replace the existing values
instead
of starting a new column?

Cheers - James

PS Richard thanks also for the simpler formula (I've just woken up -
West coast of Australia). I'm about to work through what you have
done
with that as it does seem a lot simpler than what I was using.





 
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
complex color fill conditions- if statements or complex formula? lilly8008 Excel Discussion (Misc queries) 1 December 18th 09 04:57 AM
Complex IF formula w/ time Erin Leva Excel Worksheet Functions 8 May 29th 08 12:44 PM
convert from percentage of time to time using complex formula in . Nush Excel Worksheet Functions 2 October 4th 07 05:20 PM
Complex Time Window / date based calculation stef Excel Worksheet Functions 0 September 10th 07 08:06 PM
Still adding to Complex Macro...1 step at a time. oberon.black[_6_] Excel Programming 1 September 4th 05 06:05 PM


All times are GMT +1. The time now is 02:39 AM.

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"