anyone know how to write formulas in WORD?

Lball

Board Regular
Joined
Oct 4, 2005
Messages
197
I have to use a word doc for my project and i want to use conditional formulating. I know how to insert a formula in a word table, but i keep getting an error on this IF statement. I'm looking for examples to follow, but Word doesn't give examples the way Excel does. Anyone have advice?

Here's what i'm trying to do...

I have a 2 cell table, a1 and b1.
An address pops in from other software into a1. I'm trying to use the following formula... =if(a1="30mainstreet","MC3450","MC9845")
I have a feeling that i'm not using "word's" structure properly.

ANYONE?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
You need to be a little pschyzo to switch between Word and Excel.

Word Tables don't really work like Excel cells. I wouldn't try to address actual cells in Word Tables unless you really control the environment and lock everything down.

To do what you want, I'd use the IF and STYLEREF field codes. You would format the cell you want to refer to with a special style. For example "THECELL".

Then, where you want your result, you would put in the following field code: { if { styleref “THECELL” \* MERGEFORMAT } = "ASD" "Found" "Not Found" }

The only problem with this is that field codes don't automatically update until you highlight the whole document and press F9 or do something like Print Preview.
 
Upvote 0
Thanks for your response. I would not be using Word if i didn't have to...

When you say format the cell as "THECELL" how do i do that?
 
Upvote 0
Insert a excel object in your word document. And you are able to use excel formulas etc.
 
Upvote 0
i tried to do something like that, but the excel doc had to be updated in order for the word doc to change, and the application i am using only links to word. Or was i doing something different than what you're talking about?
 
Upvote 0
Sorry, wasn't entirely clear was I, heh.

Okay, you have to create a STYLE. For example, I just named the STYLE "THECELL".

Menu it's Format/Style, and make a new style. Alternatively, I have the style in my toolbar. So I'd just highlight the cell. Press Control-S, which puts you in the style box, and then type "THECELL" which would automatically create the style.

Then you would use the IF and StyleRef field codes as I indicated in my previous post.

Remember, when you insert field codes (specifically those little brackets) remember to either use Control-F9 or via the menus Insert/Field Codes (or some such).

Again, worth re-iterating, the only problem with this is that field codes don't automatically update until you highlight the whole document and press F9 or do something like Print Preview.
 
Upvote 0
i'm still having difficulties putting this together. At this point i'm just trying to get an example of what i want to happen utimately so that i can integrate it into my project. I tried typing your equation into the 2nd cell, but it didn't do anything. Then i tried putting in the formula box, and i get a syntax error. Do you have time to walk me through an example to get it to work on my screen, then i can integrate it from there. Thanks
 
Upvote 0
Honestly, if I were to walk you through it by typing the instructions here, it would take up a ton of my time if you couldn't figure out what I've already written.

I sent you a PM with an example file I made that I've uploaded to my website.

Good luck
 
Upvote 0
That is a huge help...of course there another question...the update button, a macro i assume? How can i update my form?

THANK YOU
 
Upvote 0
I GOT IT TO WORK BEAUTIFULLY IN MY WORD DOC.

THANK YOU SO MUCH FOR YOUR HELP!!!! YOU SAVED ME HOURS OF WORK
 
Upvote 0

Forum statistics

Threads
1,224,862
Messages
6,181,465
Members
453,045
Latest member
Abraxas_X

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top