#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cell Value

I use the code below to check to see if the minutes in a day total
1440, for some reason, I am getting the MsgBox telling me that C56 does
not equal 1440. I have physically checked this, and can see the value
1440 in C56 from the formula =SUM(C55,D55)

If Sheets("Sheet1").Range("C56").Value < 1440 Then
MsgBox ("Please Check You Planned Running Time, it does not add up
to 1440")
Exit Sub
End If

Any ideas?

Thanks

Pete

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Cell Value

Hi Pete

could it be a rounding error? ...
try in C56
=ROUND(C55+D55,0)

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Pete" wrote in message
oups.com...
I use the code below to check to see if the minutes in a day total
1440, for some reason, I am getting the MsgBox telling me that C56 does
not equal 1440. I have physically checked this, and can see the value
1440 in C56 from the formula =SUM(C55,D55)

If Sheets("Sheet1").Range("C56").Value < 1440 Then
MsgBox ("Please Check You Planned Running Time, it does not add up
to 1440")
Exit Sub
End If

Any ideas?

Thanks

Pete



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cell Value

Hi Julie

Changed my formula to suit your version, and all ok. I've checked the
other cells that this value relies on, and all seem (Look) OK any
ideas?

Thanks

Pete

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cell Value

just looked, and when I print this cell value in the immediate window,
it definately shows 1440 before changing the formula to your version

Pete

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Cell Value

Hi Pete

do you want to send the file across to me and i'll see if i can spot what is
going on ... julied_ng at hcts dot net dot au

--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Pete" wrote in message
oups.com...
just looked, and when I print this cell value in the immediate window,
it definately shows 1440 before changing the formula to your version

Pete





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Cell Value

I think I've spotted it, I calculate downtime with the following
formula

U16=13:00, W16=14:00

(W16-U16+(W16<U16))*1440

Gives me 60 min downtime

I use =INT(G16/60) to get hours (=1)
I use =MOD(G16,60) to get mins (=0)

For some reason (W16-U16+(W16<U16))*1440
=60.0000000000001

What I've done is ROUND((W16-U16+(W16<U16))*1440)

Which appears to work.

I don't mind sending you the sheet, but it isn't pretty

Pete

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Cell Value

Pete,

A simple change would be

If Sheets("Sheet1").Range("C56").Text < 1440 Then

or

If Sheets("Sheet1").Range("C56").Text < "1440" Then

..Text returns what the cell actually shows, and Excel coerces the value, so
either works.

HTH,
Bernie
MS Excel MVP


"Pete" wrote in message
oups.com...
I use the code below to check to see if the minutes in a day total
1440, for some reason, I am getting the MsgBox telling me that C56 does
not equal 1440. I have physically checked this, and can see the value
1440 in C56 from the formula =SUM(C55,D55)

If Sheets("Sheet1").Range("C56").Value < 1440 Then
MsgBox ("Please Check You Planned Running Time, it does not add up
to 1440")
Exit Sub
End If

Any ideas?

Thanks

Pete



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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 02:50 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"