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

I'm trying to create a function which will replace a formulae containing
nested If statements. I'm looking for some help, because I don't have much
experience with Functions.

Here is the cell formulae
IF(COUNTIF(B2,"<Z*"),0,IF(F20,(F2+$F$270+(IF(G20 ,G2+$G$270,0))-(H2+$H$270)),IF(G20,(G2+$G$270+(IF(F20,F2+$F$270 ,0))-(H2+$H$270)),"")))

It applies the following logic to each row, presenting a result in Cell I of
each row.
With each column in F-H, If the Cell 2 value is greater than 0, add Cell 2
to Cell 270. Then apply (F+G)-H to calculate the result.

I'm stuck at the beginning with cells containing text.
'If the cell value is text then the result = 0
If myC.Value < "Z" Then SumInvoice = 0 'doesn't work?

Dylan

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Please help with simple function

Here is what I have:

Function SumInvoice(myC As Range) As String
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")

With myC
If .Cells.Value < 0 Then
SumInvoice = ""

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

Else: SumInvoice = 0

End If
End With

End Function

"Dylan" wrote:

I'm trying to create a function which will replace a formulae containing
nested If statements. I'm looking for some help, because I don't have much
experience with Functions.

Here is the cell formulae
IF(COUNTIF(B2,"<Z*"),0,IF(F20,(F2+$F$270+(IF(G20 ,G2+$G$270,0))-(H2+$H$270)),IF(G20,(G2+$G$270+(IF(F20,F2+$F$270 ,0))-(H2+$H$270)),"")))

It applies the following logic to each row, presenting a result in Cell I of
each row.
With each column in F-H, If the Cell 2 value is greater than 0, add Cell 2
to Cell 270. Then apply (F+G)-H to calculate the result.

I'm stuck at the beginning with cells containing text.
'If the cell value is text then the result = 0
If myC.Value < "Z" Then SumInvoice = 0 'doesn't work?

Dylan

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
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
NEED HELP with simple function [email protected] Excel Programming 1 July 29th 06 12:21 AM
Any Help with a Simple Function? Jacob G Excel Programming 6 December 1st 05 04:32 AM
COM Add-in - Simple Function Rasmus A Excel Programming 1 September 28th 05 02:25 PM
Simple Function HELP!!! Lori~[_2_] Excel Programming 1 September 18th 05 05:54 PM


All times are GMT +1. The time now is 09:00 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"