Formula - Subtraction in Word

G

Guest

Hi,

I promise, I have searched for a similar question before posting this one
and have not quite found what I'm looking for.

Here it is: We are creating data sheet (or curriculum vitae, if you will)
and want to simply enter the date (year) the person started with the company.

It would go like this: Ms. Jane Doe has been with the company for 8 years.

Assuming that we are in 2006 and Ms. Doe started in 1998, we would like to
create a formula that would calculate "2006 - [year of hire]"; the difference
(or the result) would be inserted in the text: 8.

Is this feasible? We do not want to enter this information in a table, but
in a letter.

Thank you!
 
C

Charles Kenyon

It is feasible, but not easy. I would gather the start date using a UserForm
or an Ask Field. The UserForm is easier and more powerful if you know how to
do vba programming. Otherwise you will end up doing date calculation fields,
which are more complex than you might imagine, but can be done. See
http://addbalance.com/word/datefields2.htm for information on the different
kinds of ways to make a date calculation work. It includes links to
utilities to create the fields and an explanation of different macros that
can be used instead of fields. It also has a link to
www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902 which is a document
with various fields already created. Another resource is
http://www.gmayor.com/insert_a_date_other_than_today.htm.

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
M

macropod

Hi Helen,

At its most basic, this is a simple formula, in the form of A-B=C, where A,
B & C are all years. If that's all you need, try this:
.. press Ctrl-F9 three times, to create a set of nested fields, like { {
{ } } }
.. move the cursor to the right of the left-most field brace and press
Ctrl-F9 to insert another field, thus { { } { { } } }
.. now, fill in around the field braces as follows:
{QUOTE{ASK StartYear " Please input the start year, in 4-digit
format"}{={DATE \@ YYYY}-StartYear}}
.. when you're done, press F9 to activate.

For anything more complicated (eg taking the day & month into account),
you'll need either a macro-based solution or a much more complex set of
fields than the ones above. For more details on the latter, and just about
everything else you might want to do with dates in Word, check out my Date
Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers
 
G

Guest

Hi Macropod,

Thank you for your suggestion. I created the formula and it did prompt me
to enter the start year. But, using your example of A-B=C, how would I enter
"2006", the "Start Year" and where would the result be?

These questions may seem very basic to you but I have always steered clear
of formulas...

Thanks for getting back to me.

Hélène


macropod said:
Hi Helen,

At its most basic, this is a simple formula, in the form of A-B=C, where A,
B & C are all years. If that's all you need, try this:
.. press Ctrl-F9 three times, to create a set of nested fields, like { {
{ } } }
.. move the cursor to the right of the left-most field brace and press
Ctrl-F9 to insert another field, thus { { } { { } } }
.. now, fill in around the field braces as follows:
{QUOTE{ASK StartYear " Please input the start year, in 4-digit
format"}{={DATE \@ YYYY}-StartYear}}
.. when you're done, press F9 to activate.

For anything more complicated (eg taking the day & month into account),
you'll need either a macro-based solution or a much more complex set of
fields than the ones above. For more details on the latter, and just about
everything else you might want to do with dates in Word, check out my Date
Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers


Helen said:
Hi,

I promise, I have searched for a similar question before posting this one
and have not quite found what I'm looking for.

Here it is: We are creating data sheet (or curriculum vitae, if you will)
and want to simply enter the date (year) the person started with the company.

It would go like this: Ms. Jane Doe has been with the company for 8 years.

Assuming that we are in 2006 and Ms. Doe started in 1998, we would like to
create a formula that would calculate "2006 - [year of hire]"; the difference
(or the result) would be inserted in the text: 8.

Is this feasible? We do not want to enter this information in a table, but
in a letter.

Thank you!
 
M

macropod

Hi Helen,

You'd simply insert the fields wherever you want the result displayed. For
example, with:
Ms. Jane Doe has been with the company for ## years
you'd put the fields where the ## is.

If you're putting the fields in a template, activate it at that time and
give it a default value (eg 2006), so that it displays 0. Then, when you
want to do the calculation, select the fields and press F9 to activate the
prompt and calculation.

Cheers


Helen said:
Hi Macropod,

Thank you for your suggestion. I created the formula and it did prompt me
to enter the start year. But, using your example of A-B=C, how would I enter
"2006", the "Start Year" and where would the result be?

These questions may seem very basic to you but I have always steered clear
of formulas...

Thanks for getting back to me.

Hélène


macropod said:
Hi Helen,

At its most basic, this is a simple formula, in the form of A-B=C, where A,
B & C are all years. If that's all you need, try this:
.. press Ctrl-F9 three times, to create a set of nested fields, like { {
{ } } }
.. move the cursor to the right of the left-most field brace and press
Ctrl-F9 to insert another field, thus { { } { { } } }
.. now, fill in around the field braces as follows:
{QUOTE{ASK StartYear " Please input the start year, in 4-digit
format"}{={DATE \@ YYYY}-StartYear}}
.. when you're done, press F9 to activate.

For anything more complicated (eg taking the day & month into account),
you'll need either a macro-based solution or a much more complex set of
fields than the ones above. For more details on the latter, and just about
everything else you might want to do with dates in Word, check out my Date
Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers


Helen said:
Hi,

I promise, I have searched for a similar question before posting this one
and have not quite found what I'm looking for.

Here it is: We are creating data sheet (or curriculum vitae, if you will)
and want to simply enter the date (year) the person started with the company.

It would go like this: Ms. Jane Doe has been with the company for 8 years.

Assuming that we are in 2006 and Ms. Doe started in 1998, we would like to
create a formula that would calculate "2006 - [year of hire]"; the difference
(or the result) would be inserted in the text: 8.

Is this feasible? We do not want to enter this information in a
table,
but
in a letter.

Thank you!
 
G

Guest

Hello again Macropod,

Thank you very much for your help; it works! Just to show you how
unfamiliar I am with the macros, I had not realized that I had to enter a
date in order for the calculation to work. Duh! Thank you again!

macropod said:
Hi Helen,

You'd simply insert the fields wherever you want the result displayed. For
example, with:
Ms. Jane Doe has been with the company for ## years
you'd put the fields where the ## is.

If you're putting the fields in a template, activate it at that time and
give it a default value (eg 2006), so that it displays 0. Then, when you
want to do the calculation, select the fields and press F9 to activate the
prompt and calculation.

Cheers


Helen said:
Hi Macropod,

Thank you for your suggestion. I created the formula and it did prompt me
to enter the start year. But, using your example of A-B=C, how would I enter
"2006", the "Start Year" and where would the result be?

These questions may seem very basic to you but I have always steered clear
of formulas...

Thanks for getting back to me.

Hélène


macropod said:
Hi Helen,

At its most basic, this is a simple formula, in the form of A-B=C, where A,
B & C are all years. If that's all you need, try this:
.. press Ctrl-F9 three times, to create a set of nested fields, like { {
{ } } }
.. move the cursor to the right of the left-most field brace and press
Ctrl-F9 to insert another field, thus { { } { { } } }
.. now, fill in around the field braces as follows:
{QUOTE{ASK StartYear " Please input the start year, in 4-digit
format"}{={DATE \@ YYYY}-StartYear}}
.. when you're done, press F9 to activate.

For anything more complicated (eg taking the day & month into account),
you'll need either a macro-based solution or a much more complex set of
fields than the ones above. For more details on the latter, and just about
everything else you might want to do with dates in Word, check out my Date
Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers


Hi,

I promise, I have searched for a similar question before posting this one
and have not quite found what I'm looking for.

Here it is: We are creating data sheet (or curriculum vitae, if you will)
and want to simply enter the date (year) the person started with the
company.

It would go like this: Ms. Jane Doe has been with the company for 8
years.

Assuming that we are in 2006 and Ms. Doe started in 1998, we would like to
create a formula that would calculate "2006 - [year of hire]"; the
difference
(or the result) would be inserted in the text: 8.

Is this feasible? We do not want to enter this information in a table,
but
in a letter.

Thank you!
 
M

macropod

Hi Helen,

I'm glad you got it working. As for the macros bit, you'll be surprised then
to learn this isn't a macro - they're quite different to Word fields.

Cheers


Helen said:
Hello again Macropod,

Thank you very much for your help; it works! Just to show you how
unfamiliar I am with the macros, I had not realized that I had to enter a
date in order for the calculation to work. Duh! Thank you again!

macropod said:
Hi Helen,

You'd simply insert the fields wherever you want the result displayed. For
example, with:
Ms. Jane Doe has been with the company for ## years
you'd put the fields where the ## is.

If you're putting the fields in a template, activate it at that time and
give it a default value (eg 2006), so that it displays 0. Then, when you
want to do the calculation, select the fields and press F9 to activate the
prompt and calculation.

Cheers


Helen said:
Hi Macropod,

Thank you for your suggestion. I created the formula and it did prompt me
to enter the start year. But, using your example of A-B=C, how would
I
enter
"2006", the "Start Year" and where would the result be?

These questions may seem very basic to you but I have always steered clear
of formulas...

Thanks for getting back to me.

Hélène


:

Hi Helen,

At its most basic, this is a simple formula, in the form of A-B=C,
where
A,
B & C are all years. If that's all you need, try this:
.. press Ctrl-F9 three times, to create a set of nested fields, like { {
{ } } }
.. move the cursor to the right of the left-most field brace and press
Ctrl-F9 to insert another field, thus { { } { { } } }
.. now, fill in around the field braces as follows:
{QUOTE{ASK StartYear " Please input the start year, in 4-digit
format"}{={DATE \@ YYYY}-StartYear}}
.. when you're done, press F9 to activate.

For anything more complicated (eg taking the day & month into account),
you'll need either a macro-based solution or a much more complex set of
fields than the ones above. For more details on the latter, and just about
everything else you might want to do with dates in Word, check out
my
Date
Calc 'tutorial', at:
http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Number=249902

Cheers


Hi,

I promise, I have searched for a similar question before posting
this
one
and have not quite found what I'm looking for.

Here it is: We are creating data sheet (or curriculum vitae, if
you
will)
and want to simply enter the date (year) the person started with the
company.

It would go like this: Ms. Jane Doe has been with the company for 8
years.

Assuming that we are in 2006 and Ms. Doe started in 1998, we would like to
create a formula that would calculate "2006 - [year of hire]"; the
difference
(or the result) would be inserted in the text: 8.

Is this feasible? We do not want to enter this information in a table,
but
in a letter.

Thank you!
 
Joined
Feb 13, 2018
Messages
1
Reaction score
0
Good Day Everyone.

i want someone to please assist me with word 2016. i need to make a formula but i only get syntex error. can someone please help me
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top