how to calculate the substraction between two dates

hi,

i have two cells ,in which  there are two dates.
(for instance ,one cel l 08/02     ,the other  07/30)

if the gap of the two dates is 2 days , something will be set to do.

but it is difficult to judge the the substraction between two dates

any good ideas.

thanks



0
youngmanca (35)
8/24/2004 2:04:54 AM
excel 39879 articles. 2 followers. Follow

3 Replies
876 Views

Similar Articles

[PageSpeed] 18

Perhaps this might be of help ..

Assume the *dates* "2-Aug-2004" and "30-Jul-2004"
are input in A1 and B1, and
A1:B1 is custom formatted as: mm/dd
viz. it'll show as:

In A1: 08/02
In B1: 07/30

Try in C1: =DAY(ABS(A1-B1))-1
Format C1 as: General or Number

C1 will return: 2
i.e. the number of days in-between the 2 dates in A1:B1
--
Rgds
Max
xl 97
---
Please respond in thread
xdemechanik <at>yahoo<dot>com
----
"EXCEL NEWS" <youngmanca@hotmail.com> wrote in message
news:#$lr$6XiEHA.2624@TK2MSFTNGP12.phx.gbl...
> hi,
>
> i have two cells ,in which  there are two dates.
> (for instance ,one cel l 08/02     ,the other  07/30)
>
> if the gap of the two dates is 2 days , something will be set to do.
>
> but it is difficult to judge the the substraction between two dates
>
> any good ideas.
>
> thanks
>
>
>


0
demechanik (4694)
8/24/2004 4:12:30 AM
> Try in C1: =DAY(ABS(A1-B1))-1


That method will work only if the difference between the two
dates is <= 31 days. Better to simply subtract one date from the
other, and format for General.


-- 
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Max" <demechanik@yahoo.com> wrote in message
news:uzhseDZiEHA.596@TK2MSFTNGP11.phx.gbl...
> Perhaps this might be of help ..
>
> Assume the *dates* "2-Aug-2004" and "30-Jul-2004"
> are input in A1 and B1, and
> A1:B1 is custom formatted as: mm/dd
> viz. it'll show as:
>
> In A1: 08/02
> In B1: 07/30
>
> Try in C1: =DAY(ABS(A1-B1))-1
> Format C1 as: General or Number
>
> C1 will return: 2
> i.e. the number of days in-between the 2 dates in A1:B1
> --
> Rgds
> Max
> xl 97
> ---
> Please respond in thread
> xdemechanik <at>yahoo<dot>com
> ----
> "EXCEL NEWS" <youngmanca@hotmail.com> wrote in message
> news:#$lr$6XiEHA.2624@TK2MSFTNGP12.phx.gbl...
> > hi,
> >
> > i have two cells ,in which  there are two dates.
> > (for instance ,one cel l 08/02     ,the other  07/30)
> >
> > if the gap of the two dates is 2 days , something will be set
to do.
> >
> > but it is difficult to judge the the substraction between two
dates
> >
> > any good ideas.
> >
> > thanks
> >
> >
> >
>
>


0
chip1 (1821)
8/24/2004 2:08:03 PM
"Chip Pearson" <chip@cpearson.com> wrote
> > Try in C1: =DAY(ABS(A1-B1))-1
>
> That method will work only if the difference between the two
> dates is <= 31 days. Better to simply subtract one date from the
> other, and format for General.

Yes, you're right.
Thanks for the correction, Chip
... I goofed, plain and simple ..
--
Rgds
Max
xl 97
--
Please respond, in newsgroup
xdemechanik <at>yahoo<dot>com
---


0
demechanik (4694)
8/24/2004 3:11:11 PM
Reply:

Similar Artilces:

Date construct with DatePart is kicking my.... well, you know.
Private Sub cmdCreatePath_Click() Dim strDateCons As String <bunch of my code that is (surprisingly) working like it should> strDateCons = DatePart(yyyy, Me.txtDateEntered) & "-" & DatePart(mm, Me.txtDateEntered) & _ "-" & DatePart(dd, Me.txtDateEntered) Debug.Print strDateCons End Sub When I click the magic button... nuffin'! I get an error message that states "Compile error: Variable not defined" and it highlights the 'yyyy' part of my first DatePart statement. What I actually wanted it to do was to take the date ...

Sum a column that meets two criteria
I need to sum a column of numbers if it matches two different criteria. I can set up the SUMIF easily for meeting one criteria, but I need to also sum the column if it meets that criteria, and another. For example: A B C 1 150 ABC MS1 2 200 DEF MS0 3 100 LMN MS0 4 125 ABC MS1 5 175 LMN MS1 6 225 DEF MS0 I need to have a formula that would say <<Sum column A IF column B = "DEF" AND column C = "MS0">>. (and so forth for the other combinations). I know there has to be a way to do this, probably using a combination of an IF and SUMIF functions - but i keep...

Lookup two columns
I want to compare the contents of two (adjacent) cells in one sheet with two adjacent cells in another sheet (within one workspace) and if the *pair* of cells are the same, deliver the value in the cell a few columns along (if you know what I mean - like lookup but comparing two cells). The cells are not sorted. Any ideas? Cheers. Bobby If you are comparing A1-B1 sheet 1 to A1-B1 sheet 2, then =IF(AND(Sheet1!A1=Sheet2!A1,Sheet1!B1=Sheet2!B1),"They match","no match") If you have to "lookup" A1-B1 against the whole columns of A and B on sheet2, then kyou co...

Calculate the % increase for two columns
I have a pivot table, the data was first display by date, i know i can use the grouping function to group data into monthly basis. But I want to know that can I set the formula to calculate the months difference between, say the sales amount of June & July, and the % of the difference?? Million thanks If you have a grouped field, you won't be able to add a calculated item to the pivot table. In the source data, you could add a column to calculate the month for each record. Refresh the pivot table, and add the new field Add another copy of the Data field to the data area Right-c...

Changing a text field to a date field
Hi I know this is a problem for lots of people but I still cant find an answer. I have imported a text file into excel with a number field that displays credit card expiry dates as a 4 digit number. example 0408 so month + year. I have converted the number field to a text field so it doesnt drop off the first zero and now I need to convert it to a date field. Any nice easy simple ideas. Any help would be much appreaciated. Or direction to a question the same. Perhaps =DATE(100+RIGHT(A1,2),LEFT(A1,2),1) format as date -- daddylonglegs --------------------------------------------...

Date and time onto a form
Hi, I am designing a form that my client would like the date and time automatically recorded in a field and stored so that when they refer back it shows when the record was done. The 'NOW' function only shows the current date & time and keeps updating. Is there a way of putting the 'NOW' value into a field, then locking it so it doesn't change when the record is reopened. Hope that makes sense! Kazlou The form stores data in a table. You need to add a date/time field to your table to record the date and time a record was last updated. 1. Open the table in desig...

Forms in two differant views
Is there a way to use the same sub form showing two differant views within the same Main Form. For example: Can I show on one tab a datasheet view and on the other a regular form view. -- Rose Hi Rose, Create a button on your form and under the "OnClick" event put 'Me.DefaultView = Datasheet Alternatively you could use a checkbox If me.checkbox1 = 0 then Me.DefaultView = 2 ' Datasheet Else Me.DefaultView = 0 'Single Form End if me.repaint This should flick the form between datasheet and form views. HTH, Nick. "Rose" wrote: > Is there a way to use t...

date #4
Hi All I live in South Africa, and I have an interesting problem that persists in Excel 2003 and 2007. =TEXT(NOW(),"dd mmm yyyy") returns 15 Dec 2006 =month(now()) returns 12 =text(month(now()),"MMMM") returns January =year(now()) returns 2006 =text(year(now()),"yyyy") returns 1905 Why would this be? Thanks Chris Chris, =text(month(now()),"MMMM") should be =text(now(),"MMMM") and =text(year(now()),"yyyy") should be =text(now(),"yyyy") or just =year(now()) Otherwise, you are calcing the month of the 12th day afte...

Date question 01-14-10
Can anyone help with this function: =IF[Date Parts Ordered Completed]+ [Date Part Completed]+[Date Purchasing Completed],not blank,=Date The goal is that is all three fields have a date in them, then put in today's date in the final field. If one of the dates is missing, then the final date is blank. The only problem is if I open up that form I do not want it to change the date to today. I want it to stay the date of the actual completion. Any help is greatly appreciated. Thanks, P-Chu -- Message posted via http://www.accessmonster.com Try this -- Completion_...

How to show the month of the referenced cell (containing a date)
If a cell holds the date "2/1/08", what formula can I use that will give me the following result: "Feb - 08" I tried =Month(a2)......but I just get the number of the month. Thanks. =TEXT(A2,"mmm - yy") Or simply =A2 with the cell custom formatted mmm - yy HTH. Best wishes Harald "Dave K" <fred.sheriff@gmail.com> skrev i melding news:165b03da-19ba-40b8-b9fe-77b17ef045b5@d45g2000hsc.googlegroups.com... > If a cell holds the date "2/1/08", what formula can I use that will > give me the following result: > > "Feb - 08&...

PrintPreview
Hello, I developed a VC++/MFC SDI application. The program supports PrintPreview. However, I only want the user to go forward ("Next Page") and not backward ("Prev Page"). How do I hide the "Prev Page" and "Two Page" buttons? TIA, Jacques Hello All, I found a nice Print Preview replacement toolbar (with bitmap buttons) on codeguru. To hide the "Prev Page" and "Two Page" buttons, simply remove them from the CMyPreviewView::OnCreate(LPCREATESTRUCT lpCreateStruct) method. The article was written by Robin J. Leatherbarrow. Thank...

Run two copies of Outlook with different profiles
Hello! I'm trying to run two copies of Outlook with different (outlook)profiles at the same time. Normally i can choose the profile with the /profile switch, but if there is already a copy of outlook running, this switch seems to be ignored. Any ideas how to handle this are welcome. Regards, Reinhard "Reinhard" <reinhard.spieker@bkvibro.de> wrote in message news:60a7e218.0311190408.6523100b@posting.google.com... > Hello! > > I'm trying to run two copies of Outlook with different > (outlook)profiles at the same time. > > Normally i can choose the p...

Excel does not calculate my formulas
This is very strange...Excel does not calculate any formula. I can do a simple =A1+A2, and it just return a zero value. I made sure of the following: - Cell is set to General (tried it with different cell settings too) - Autocalc is on in settings (even a manual F9 calc doesn't work) -- Martin Verville We might need a few more clues: What is in A1? What is in A2? -- David Biddulph "Martin" <Martin@discussions.microsoft.com> wrote in message news:A9A25385-5BE8-4D38-A7A7-15E523C69DD9@microsoft.com... > This is very strange...Excel does not calculat...

GL Posting date is missing or invalid error message
Hello, When trying to post a Sales order through Sales transactions entry window, we get an error message 'General ledger posting date is invalid or missing' The dates seem correct. The fiscal periods are all set up correctly. This happens whether we try to post an individual transcation or a batch. The batch looks like it is posting, but all the posting reports have zero mamounts in them & the batch still sits there even after posting as if it has never been posted. We are running GP 8.00g34 What is causing this & how do we fix it? Thanks Did you recently change your pos...

Bug in receiving entry. error calculating Prev Qty Shipped
Dynamics GP Bug Report, version 9.0 service pack 1. Version Information: 9.00259 Location: Receiving Transaction Entry Description: As one enters receiving transactions lines and adjusts the Qty Shipped, the quantity previously shipped is calculated incorrectly. This PO transaction was for a quantity of 120. A quantity of 15 were received on a previous shipment. The Qty previously shipped should display 120-15-30=75 not 45. To make this error occur continue to change the Qty Shipped. Sometimes the error will occur quickly, other times it might take 25 changes. Products Load...

Date range for a report
Hi I am trying to run a query and can't seem to nail down the right code. We use the access database to track files, incoming/outgoing correspondence dates etc. I am trying to run a query that show me files with dates in a follow up field of -60 days to +7 days, so essentially any follow ups missed in the last 2 months and up coming in the next week. This report is run on a weekly basis. Appreciate any help Thanks Assuming that the follow up field is actually a date/time data type, try this in the criteria: Between Date() - 60 and Date() + 7 -- Jerry Whittle, ...

lost two months of received emails
Help I lost about 2 months of received emails. They are not in my deleted folder. I already tried the pst restore utility. Thanks ...

Date Formula #3
I am having difficulty with the "NOW" formula. What I would like for it to do is when I enter a value in one cell have it update in another cell the date when the information was entered and that date stay permanenty. What I am having is the date changes to the current date everyday. Is this possible to do? Any help would be appreciated. Thanks. Todd You can do it with the change event of the worksheet This example will place the date/time in the B column if you change a cell in the range A1:A20. Place the code in the Sheet module Right click on a sheet tab and choose ...

calculating quantity on hand based on date-time stamp
Hello: I am always unclear on the proper syntax for pulling date-related data. I need to pull a field in my query, below, based on the field called "IV00118.CHANGEDATE_I". This is the date in which an end user changed the cost of an item. To give you some background, the IV00102 table in my query below is the Item Quantity Master table, while the IV00118 table is the Item Cost Change History table. The field that I want to pull based on that date field is the IV00102.QTYONHND field. This field is the inventory quantity on hand field. How would I format the syntax bel...

Formula to display Count of Days in given month, using list of Start and End Dates
I have a large number of rows that contain a start date and end date. I am attempting to generate a count of days within that date range that are in a particular month, for example, Jan of 2011. Any suggestions for a formula that could be used to display the amounts shown in Column C would be helpful. Layout is: A B C Start Date End Date Count of Days in Jan2011 1/10/11 4/7/11 21 2/6/11 3/1/11 0 12/20/10 2/15/11 31 Etc. Dave, I think the best way is to create a table f...

SUMIFS with Dates
I have a conditional SUMIFS Detail Sheet Type Date Qty Credit 2/1/10 1 Sales 2/2/10 2 Credit 2/15/10 3 Summary Sheet Week # Start Date End Date Credits Sales 1 2/1/10 2/5/10 1 2 2 2/8/10 2/15/10 3 0 So, basicallay I am summing the Credit column if the Detail is Type Credit and the Date is >= the Start Date on the line and the End Date <= the Date on the line. Same for Sales. However, as simple as it seems, it just seems not lo l...

email sent/received dates
Hi, I'm using MSN Premium included with Verizon DSL and decided to take advantage of the 2g email storage and outlook connector for msn. Got it set up and working. I created a new folder to archive some email before I copy it to the archive pst on my pc so I can search it remotely. No problems. Today, I noticed all my dates changed on sent and received email that I moved. Worse, the header in the email (that outlook displays) shows this new date and doesn't reflect the original email date. I was moving mail from our company exchange server that was ready to be deleted to this fo...

Dynamics CRM 4.0
Hi, I've modified the format in the system settings screen to be "English (United Kingdom)", however all dates are still appearing in US format. Even when you expand the calendar control it displays incorrectly. Numeric values are correct - showing the pound sign and correct decimal point. I've restarted IIS, made sure all SQL logins are British English and the default regional settings of the server are set to British English. Even rebooted the server but this still hasn't corrected the problem. Can anybody tell me how to resolve this please Thanks I was looking ...

range color from date and database
newbie done some homework on excel i would like to have a range change color based on date and time and a name from a database--or any suggestion for example if it is thursday and the time is betweeen 1 and 3 pm i want the range to be say light red if out of tinme range i want it to be light green also the cell above the range as long as time constraints are met to have a name from a datasource any suggestions or ideas apprciated i need to have data from either a database or from say another sheet where user can enter a form the data from the datasource would fill range values a...

Two companies on SBS
Is it possible to implement CRM for two different companies on a Small Business Server? "sort of". Some things to consider: 1. Are both companies sharing the same Active Directory? Natively, not just using things like email - are their computers authenticating to the domain? 2. You could use the SAME instance of CRM, and create Business Units. If they want drastically different views, however, that could be difficult to set up for them. 3. If you want two separate instances of CRM - then you need an additional web/app server for the 2nd company. I belive that second...