View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
davegb davegb is offline
external usenet poster
 
Posts: 573
Default inserting formula


Gary Keramidas wrote:
i don't know what ""d"" is,
""d"" & ")+1
is it a variable, a column letter wit hte row missing? why is it in double
quotes? this part doesn't make sense to me, but i'm no expert

--


Gary


The "d" is the parameter that tells datedif what units to give the
difference in, in this case, days.

It's in double quotes because it has to be in quotes in the final
formula.


"davegb" wrote in message
oups.com...
I'm trying to insert the following formula into my spreadsheet using
the following code

'insert formula =IF(G2<"",DATEDIF(G2,H2,"d")+1,"")

.cells(lnextrow,"I").formula="=IF(G" & lprevsumrow &
"<" & """" _
& ",DATEDIF(G" & lprevsumrow & ",H" & lprevsumrow &
"," & ""d"" & _
")+1, "& """" & ")"

The row will not always be 2, but will be a long variable called
lPrevSumRow.

I'm getting an "end of statement" compile error, highlighting the d in
double quotes. I'm missing something in the syntax. But what the *&^%
is it?

Thanks again.