Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Request help with Arithmentic UDF

Please tell me why this isn't working.

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long

Est = myC.Offset(0, 3).Value + Cells("K134")
Fore = myC.Offset(0, 4).Value + Cells("K135")
Prev = myC.Offset(0, 5).Value + Cells("K136")

If myC.Cells.Text < "Z*" Then
SumInvoice = 0

ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev

Else: SumInvoice = 0

End If
End Function
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Request help with Arithmentic UDF

Maybe

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long
Est = myC.Offset(0, 3).Value + Range("K134").Value
Fore = myC.Offset(0, 4).Value + Range("K135").Value
Prev = myC.Offset(0, 5).Value + Range("K136").Value
If myC.Cells.Text < "Z*" Then
SumInvoice = 0
ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev
Else: SumInvoice = 0
End If
End Function

Mike

"Dylan" wrote:

Please tell me why this isn't working.

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long

Est = myC.Offset(0, 3).Value + Cells("K134")
Fore = myC.Offset(0, 4).Value + Cells("K135")
Prev = myC.Offset(0, 5).Value + Cells("K136")

If myC.Cells.Text < "Z*" Then
SumInvoice = 0

ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev

Else: SumInvoice = 0

End If
End Function

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Request help with Arithmentic UDF

Thanks Mike. Still doesn't work though.

=IF(B128"Z*",0,SUM(SUMIF((F128,F270),F1280,(F2,F 270)),(SUMIF((G128,G270),G1280)),(SUMIF((H128,H27 0),H1280))))

I can't even get this function to work it out either. Show's how much of a
novice I am. I figure if I can get the function to work I can convert it into
a UDF.



"Mike H" wrote:

Maybe

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long
Est = myC.Offset(0, 3).Value + Range("K134").Value
Fore = myC.Offset(0, 4).Value + Range("K135").Value
Prev = myC.Offset(0, 5).Value + Range("K136").Value
If myC.Cells.Text < "Z*" Then
SumInvoice = 0
ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev
Else: SumInvoice = 0
End If
End Function

Mike

"Dylan" wrote:

Please tell me why this isn't working.

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long

Est = myC.Offset(0, 3).Value + Cells("K134")
Fore = myC.Offset(0, 4).Value + Cells("K135")
Prev = myC.Offset(0, 5).Value + Cells("K136")

If myC.Cells.Text < "Z*" Then
SumInvoice = 0

ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev

Else: SumInvoice = 0

End If
End Function

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Request help with Arithmentic UDF

Hi Mike,

I managed to get a solution for the function as follows, but I would like to
convert it to a UDF.

=IF(ISTEXT(B128),0,IF(F20,F2+F128)+IF(G20,G2+G12 8)+IF(H20,H2+H128))

Solution provided by Sandy Mann at
http://www.microsoft.com/communities...&lang=en&cr=us

"Dylan" wrote:

Thanks Mike. Still doesn't work though.

=IF(B128"Z*",0,SUM(SUMIF((F128,F270),F1280,(F2,F 270)),(SUMIF((G128,G270),G1280)),(SUMIF((H128,H27 0),H1280))))

I can't even get this function to work it out either. Show's how much of a
novice I am. I figure if I can get the function to work I can convert it into
a UDF.



"Mike H" wrote:

Maybe

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long
Est = myC.Offset(0, 3).Value + Range("K134").Value
Fore = myC.Offset(0, 4).Value + Range("K135").Value
Prev = myC.Offset(0, 5).Value + Range("K136").Value
If myC.Cells.Text < "Z*" Then
SumInvoice = 0
ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev
Else: SumInvoice = 0
End If
End Function

Mike

"Dylan" wrote:

Please tell me why this isn't working.

Function SumInvoice(myC As Range) As Long
Dim Est As Long
Dim Fore As Long
Dim Prev As Long

Est = myC.Offset(0, 3).Value + Cells("K134")
Fore = myC.Offset(0, 4).Value + Cells("K135")
Prev = myC.Offset(0, 5).Value + Cells("K136")

If myC.Cells.Text < "Z*" Then
SumInvoice = 0

ElseIf Est 0 Or Fore 0 Then
SumInvoice = (Est + Fore) - Prev

Else: SumInvoice = 0

End If
End Function

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Request for Help [email protected] Excel Programming 3 July 11th 07 05:45 PM
Request Barry Excel Discussion (Misc queries) 1 January 5th 07 06:20 AM
sql.request teepee Excel Discussion (Misc queries) 2 December 30th 05 01:34 PM
Request .. debra2468[_9_] Excel Programming 1 August 4th 04 09:23 PM
Add-on to last request Pepe[_2_] Excel Programming 0 January 15th 04 02:25 PM


All times are GMT +1. The time now is 04:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"