View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
jille jille is offline
external usenet poster
 
Posts: 7
Default Write an IF function for Excel while in Word

OK,

Sounds like you're not looking for a programmatic solution. So there is
actually a couple of ways to approach this according to your description. You
can either embed an Excel spreadsheet in Word and then use the normal
formulas or you can create a table in Word and enter a formula by opening the
Table menu and selecting Formula. There is an option there to use a function
and "if" is one of them.

"Gatorbaby03" wrote:

I'm taking a class in Microsoft Excel, part 1 of our assignment states: Open
MS Word and write an IF function for cell H3 that assigns the value of cell
A7 to cell H3 if the value in cell J7 is less than the value in cell Q2;
otherwise, have the IF function assign zero(0) to cell H3.
I'm sure we haven't done this in my class, we've only done IF functions on
Excel itself. If you by chance understand this could you explain it to me. I
was still confused after reading what you wrote.
Thanks,
Tiffany

"jille" wrote:

Not sure what you're up to but the single line of code that accesses an excel
function could look like this:

result= Excel.Application.WorksheetFunction.if(a1 = b1, "true", "false")

Three things to do first though:

-You have to declare the worksheet in question as an object
-create the object using GetObject or CreateObject (probably GetObject since
I assume you already have an Excel file)
-and also attach the Excel object model (References)

Hope this gets you started in the right direction
Jille


"Gatorbaby03" wrote:

Can anybody help me to figure this out? I'm not really sure what to do for
this. Thank you