Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
After a lot of searching of this forum, the knowledge base, and the help
files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#2
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
The short answer is that you can do this - if
http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#3
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
Graham,
I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#4
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
This was my reply to your message in another group - a good example IMO of
why it's not a good idea to post the same question separately to different groups (in short: why do you imagine that your time is more valuable than ours?): The comparisons are text comparisons rather than date comparisons. To do a date comparison you need the dates in YYYYMMDD format, so e.g. { IF { REF LetterDate \@YYYYMMDD } = { REF YearEndDate \@YYYYMMDD } "ending" "ended" } is more likely to do the trick. But of course it will only work if Word recognises the texts as dates and converts them correctly. Peter Jamieson "Karin" wrote in message ... Graham, I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#5
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
Peter,
I didn't start out asking the same question. The original question is why can't word handle dates? I replied to Graham's question of what I wanted to do. I still want to know why Word doesn't have a date field that can be filled in by a user and calculated. I'm clearly not the only one on this forum wanting to manipulate date information. Don't assign words or thoughts to me that aren't there. I don't imagine you're more important than me! "Peter Jamieson" wrote: This was my reply to your message in another group - a good example IMO of why it's not a good idea to post the same question separately to different groups (in short: why do you imagine that your time is more valuable than ours?): The comparisons are text comparisons rather than date comparisons. To do a date comparison you need the dates in YYYYMMDD format, so e.g. { IF { REF LetterDate \@YYYYMMDD } = { REF YearEndDate \@YYYYMMDD } "ending" "ended" } is more likely to do the trick. But of course it will only work if Word recognises the texts as dates and converts them correctly. Peter Jamieson "Karin" wrote in message ... Graham, I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#6
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
Word is a word processor. If you want to do calculations use a spreadsheet.
-- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Karin" wrote in message ... Peter, I didn't start out asking the same question. The original question is why can't word handle dates? I replied to Graham's question of what I wanted to do. I still want to know why Word doesn't have a date field that can be filled in by a user and calculated. I'm clearly not the only one on this forum wanting to manipulate date information. Don't assign words or thoughts to me that aren't there. I don't imagine you're more important than me! "Peter Jamieson" wrote: This was my reply to your message in another group - a good example IMO of why it's not a good idea to post the same question separately to different groups (in short: why do you imagine that your time is more valuable than ours?): The comparisons are text comparisons rather than date comparisons. To do a date comparison you need the dates in YYYYMMDD format, so e.g. { IF { REF LetterDate \@YYYYMMDD } = { REF YearEndDate \@YYYYMMDD } "ending" "ended" } is more likely to do the trick. But of course it will only work if Word recognises the texts as dates and converts them correctly. Peter Jamieson "Karin" wrote in message ... Graham, I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#7
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
I don't imagine
you're more important than me! Glad to hear it, and apologies if I misunderstood. However, the reality is still as I said before - there is no technical reason why Word couldn't do it, but Microsoft has chosen not to provide thsoe facilities in the "field language," and only they know for sure why. Any of us can certainly speculate, and I would do so for fun, but since it doesn't actually result in any useful change it seems a bit of a waste of time :-) Peter Jamieson "Karin" wrote in message ... Peter, I didn't start out asking the same question. The original question is why can't word handle dates? I replied to Graham's question of what I wanted to do. I still want to know why Word doesn't have a date field that can be filled in by a user and calculated. I'm clearly not the only one on this forum wanting to manipulate date information. Don't assign words or thoughts to me that aren't there. I don't imagine you're more important than me! "Peter Jamieson" wrote: This was my reply to your message in another group - a good example IMO of why it's not a good idea to post the same question separately to different groups (in short: why do you imagine that your time is more valuable than ours?): The comparisons are text comparisons rather than date comparisons. To do a date comparison you need the dates in YYYYMMDD format, so e.g. { IF { REF LetterDate \@YYYYMMDD } = { REF YearEndDate \@YYYYMMDD } "ending" "ended" } is more likely to do the trick. But of course it will only work if Word recognises the texts as dates and converts them correctly. Peter Jamieson "Karin" wrote in message ... Graham, I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#8
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
It does have a date field that can be calculated - Peter already showed you
how to do that, which is why I did not reply earlier. You have to set the date format in the calculation but for that to work reliably the date entered in the form field has to be a legitimate date. You can help that by setting the field type to Date. Then { IF{Date1 \@ "yyyyMMdd" } {Date2 \@ "yyyyMMdd" } "Greater" "Less" } There's more on this at http://www.gmayor.com/formatting_word_fields.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: Peter, I didn't start out asking the same question. The original question is why can't word handle dates? I replied to Graham's question of what I wanted to do. I still want to know why Word doesn't have a date field that can be filled in by a user and calculated. I'm clearly not the only one on this forum wanting to manipulate date information. Don't assign words or thoughts to me that aren't there. I don't imagine you're more important than me! "Peter Jamieson" wrote: This was my reply to your message in another group - a good example IMO of why it's not a good idea to post the same question separately to different groups (in short: why do you imagine that your time is more valuable than ours?): The comparisons are text comparisons rather than date comparisons. To do a date comparison you need the dates in YYYYMMDD format, so e.g. { IF { REF LetterDate \@YYYYMMDD } = { REF YearEndDate \@YYYYMMDD } "ending" "ended" } is more likely to do the trick. But of course it will only work if Word recognises the texts as dates and converts them correctly. Peter Jamieson "Karin" wrote in message ... Graham, I have two ask fields (LetterDate and YearEndDate). I want to change text based on the dates: If LetterDate is = YearEndDate "ending" "ended" I can have the information entered in the ask fields in any format, but it needs to be displayed as mmmm dd, yyyy (January 16, 2007) in the letter. I'm not much of a programmer, but it doesn't seem like this should be so difficult. "Graham Mayor" wrote: The short answer is that you can do this - if http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 doesn't give you any ideas, tell us what you are trying to do. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org Karin wrote: After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#9
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
You would really have to ask Microsoft that question (the regular responders
in here are not MS employees). The probable reason is that Microsoft sees no good commercial reason to improve things in this area when demand for other facilities has (presumably) been much stronger. There is no technical reason why Word could not handle date entry and date calculations a lot better than it does. Of course, there are non-trivial problems such as the impossibility of telling what format a date is in - e.g. is 5/6/2007 6th May (cf. in the US) or 5th June (cf. in the UK), and the difficulty of dealing with multilingual date entry, but those problems can be dealt with in one way or another. Peter Jamieson "Karin" wrote in message ... After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#10
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
It can with a little bit of VBA using the DateAdd(), DateDiff() functions
for example. Or if you are a field masochist/afficionado like fellow MVP Macropod, you can do it as shown at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Karin" wrote in message ... After a lot of searching of this forum, the knowledge base, and the help files, I can't help but wonder Why can't Word handle dates? Why can't I ask a user for different date information and do calculations on the input? |
#11
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
Macropod has the calculations perfect, but I need a way of making the setup
of one of his amazing date field calculations, 'user-interactive'. Here's what I'm trying to do: A word .doc has a table that shows a proposed event schedule in this format: Event 1 (notification to proceed [ntp]) Event 2 (ntp+5 days) Event 3 (ntp+12 days) etc. The goal is to let the user type in an initial NTP date in the first row, and type in various numbers of days in the remaining rows, and then by refreshing all the fields, the actual calendar dates for all the subsequent events are automagically calculated and appear in the table. example of desired results: Event 1 (notification to proceed [ntp]): January 1, 2009 typed by user) Event 2 (ntp+5 days): January 6, 2009 (automatically calculated) Event 3 (ntp+12 days) January 13, 2009 (automatically calculated) Macropod's calcuation for this, (found in his downloadable DateCalc document) is entitled, "calculate a day, month and year, using n days delay". It requires key values in his field calculation formula to be manually modified by the 'programmer' - how do we make them user-interactive? "Doug Robbins - Word MVP" wrote: if you are a field masochist/afficionado like fellow MVP Macropod, you can do it as shown at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 |
#12
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
I'm not sure there is a /really/ easy way to do this because AFAICS the user
will have to copy a "macropod" formula into every row of the table. Nor am I completely sure what table layout you are aiming for. But here's an approach that might be workable for simple tables with no missing rows. Let's suppose you have just two columns, A and B In row 1 the user puts a date (say 29 Aug 2007) in column B, i.e. cell B1. They also have to bookmark this date, not the cell containing it - let's say the bookmark name is "mydate". The date has to be in a format that Word can recognise and split correctly into day, month, year using date format switches In column A, row 2 and downwards, the user puts a number of days to add. In every cell in column B, you put a copy of macropod's "Calculate a day, date, month and year, using n days delay" fields with the following changes: - everywhere he uses a DATE field, you change DATE to MYDATE - change the { SET Delay 14 } field to { SET Delay{={QUOTE A{={SEQ R}+1}}}} - personally I also have to change the sequence in the last field to {yy}-{mm}-{dd} which I suspect works everywhere. In essence in row 2 this is doing { SET Delay {=A2} } and in a table { =A2 } is the value in cell A2, as long as it is a number. It relies on the fact that you never use { SEQ R } except in this place in this column. You might be better off "resetting the SEQ R sequence before the first "macropod" field e.g. using { SEQ R \r1\h } and then just using { SET Delay{={QUOTE A{SEQ R}}}} There's a lot to go wrong in there! -- Peter Jamieson http://tips.pjmsn.me.uk "Bob W" wrote in message ... Macropod has the calculations perfect, but I need a way of making the setup of one of his amazing date field calculations, 'user-interactive'. Here's what I'm trying to do: A word .doc has a table that shows a proposed event schedule in this format: Event 1 (notification to proceed [ntp]) Event 2 (ntp+5 days) Event 3 (ntp+12 days) etc. The goal is to let the user type in an initial NTP date in the first row, and type in various numbers of days in the remaining rows, and then by refreshing all the fields, the actual calendar dates for all the subsequent events are automagically calculated and appear in the table. example of desired results: Event 1 (notification to proceed [ntp]): January 1, 2009 typed by user) Event 2 (ntp+5 days): January 6, 2009 (automatically calculated) Event 3 (ntp+12 days) January 13, 2009 (automatically calculated) Macropod's calcuation for this, (found in his downloadable DateCalc document) is entitled, "calculate a day, month and year, using n days delay". It requires key values in his field calculation formula to be manually modified by the 'programmer' - how do we make them user-interactive? "Doug Robbins - Word MVP" wrote: if you are a field masochist/afficionado like fellow MVP Macropod, you can do it as shown at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 |
#13
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
You said it! but it just might work, with enough duct tape...
"Peter Jamieson" wrote: There's a lot to go wrong in there! -- Peter Jamieson http://tips.pjmsn.me.uk |
#14
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
Calculating Dates
Hi Bob,
The date calculation example under the heading 'Date and Time Calculations in a Table' is already interactive, in that it solicits both the start date (your ntp date) and the number of days to offset. For your purposes, you apparently need the number of days to offset to be hard-coded, and you need two calculated results. To do that, what I'd suggest doing is: .. use the first field from example under the heading 'Date and Time Calculations in a Table' or, if you're setting your document up as a form, use a date-formatted formfield, give it a bookmark name of 'StartDate' and set its properties to 'calculate on exit'; .. use the second and third fields from the example under the heading 'Calculate a Date Sequence' and: . modify the second field by replacing all instances of 'DATE' with 'StartDate' and changing the 'SET Delay' field's value from '1' to '5'; and . modify the third copy by copying the 'SET Delay' field from the second field and changing it's value to '7'. Cheers "Bob W" wrote in message ... Macropod has the calculations perfect, but I need a way of making the setup of one of his amazing date field calculations, 'user-interactive'. Here's what I'm trying to do: A word .doc has a table that shows a proposed event schedule in this format: Event 1 (notification to proceed [ntp]) Event 2 (ntp+5 days) Event 3 (ntp+12 days) etc. The goal is to let the user type in an initial NTP date in the first row, and type in various numbers of days in the remaining rows, and then by refreshing all the fields, the actual calendar dates for all the subsequent events are automagically calculated and appear in the table. example of desired results: Event 1 (notification to proceed [ntp]): January 1, 2009 typed by user) Event 2 (ntp+5 days): January 6, 2009 (automatically calculated) Event 3 (ntp+12 days) January 13, 2009 (automatically calculated) Macropod's calcuation for this, (found in his downloadable DateCalc document) is entitled, "calculate a day, month and year, using n days delay". It requires key values in his field calculation formula to be manually modified by the 'programmer' - how do we make them user-interactive? "Doug Robbins - Word MVP" wrote: if you are a field masochist/afficionado like fellow MVP Macropod, you can do it as shown at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculating dates in word tables | Tables | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help | |||
Windows explorer dates to match Word dates | Microsoft Word Help |