Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-04-2012, 10:39 AM
gbaker gbaker is offline If formula for subtracting dates Windows 7 32bit If formula for subtracting dates Office 2010 32bit
Competent Performer
If formula for subtracting dates
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default If formula for subtracting dates

I am trying to make this formula work.



9/11/12= c19

If(C19>=Z19,1,2)

01/18/12
=z19

C19 is more than Z19 so I should get a 1 but I get a 2.

Does it have something to do with the fact that these are dates. If so any suggestions to make it work.
Reply With Quote
  #2  
Old 10-04-2012, 10:44 PM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline If formula for subtracting dates Windows 7 64bit If formula for subtracting dates Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

I suppose they are text looking like dates, not real dates

perhaps try the following
Code:
=If(C19*1>=Z19*1,1,2)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #3  
Old 10-05-2012, 05:47 AM
gbaker gbaker is offline If formula for subtracting dates Windows 7 32bit If formula for subtracting dates Office 2010 32bit
Competent Performer
If formula for subtracting dates
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default If formula for subtracting dates

Works like a charm, Thanks Pecoflyer, I appreciate the help!!!
Reply With Quote
  #4  
Old 10-06-2012, 05:45 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline If formula for subtracting dates Windows 7 64bit If formula for subtracting dates Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

My pleasure, but do you know WHY it works?
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #5  
Old 10-07-2012, 05:18 AM
gbaker gbaker is offline If formula for subtracting dates Windows 7 32bit If formula for subtracting dates Office 2010 32bit
Competent Performer
If formula for subtracting dates
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default If formula for subtracting dates

Hi Pecoflyer,
I am not sure how it works. By taking the date times one change it to a number which allows it to be subtracted. Can you explain?
Thanks in advance
gbaker
Reply With Quote
  #6  
Old 10-07-2012, 06:59 AM
Pecoflyer's Avatar
Pecoflyer Pecoflyer is offline If formula for subtracting dates Windows 7 64bit If formula for subtracting dates Office 2010 64bit
Expert
 
Join Date: Nov 2011
Location: Brussels Belgium
Posts: 2,779
Pecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant futurePecoflyer has a brilliant future
Default

In fact, when you perform an arithmetic operation on a text string it coerces it to a number. (obvioulsy "abcd" stays "abcd")
If you have a text string like 012345, any arithmetic operation involving this string will coerce it. In your example if you tried C19-Z19 it would work.
OTOH,the comparison operator not being an arithmetic operator does not accomplish this, therefore one has to " cheat" by doing something like *1 or +0 or exp1, etc...
Just be aware that in XL ( as in real life ) what you see is not always what is there.
There are giveaways though. Left aligned cells are text and right aligned are numbers ( if not aligned manually)
The ISTEXT function can help you also.
If you want to know more, delve in the forums, you'll learn a lot
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post
Reply With Quote
  #7  
Old 10-07-2012, 07:06 AM
gbaker gbaker is offline If formula for subtracting dates Windows 7 32bit If formula for subtracting dates Office 2010 32bit
Competent Performer
If formula for subtracting dates
 
Join Date: May 2012
Posts: 111
gbaker is on a distinguished road
Default If formula for subtracting dates

Hi Pecoflyer,
This has been very educational. I am always interested in learning more. I do use the forum whenever I need help and have always received great information. I've been working with Excel for over 20 years and still learn something new every day!!!
Thanks again for you helo with this.
gbaker
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to add dates terricritch Excel Programming 10 11-08-2011 09:51 AM
If formula for subtracting dates Calculating dates Daria11 Word VBA 1 06-08-2011 06:54 PM
If formula for subtracting dates Mail Merge and GMT/UTC Dates dev98 Mail Merge 2 05-06-2011 05:02 AM
If formula for subtracting dates Calculated dates. Ziggy-R Word 10 09-28-2010 01:42 AM
Adding dates mkkram Word 0 11-27-2006 09:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:32 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft