Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Ignoring cells using IF

I have a really long formula that works perfectly except for one thing. Here
is the formula below, it looks complicated but its just the same couple
formulas over and over for different cells. One thing I am trying to do is if
b8= "" or 0, then I want the output to ignore A8 otherwise let the formula
continue. So basically if there is nothing in B8 then I dont want the output
to spit out the contents in A8.

=IF(A8<0,A8&"\r","")&IF(B8<0,B8*100&"\r","")&IF( A8=11302,$G$1&"\r","")&IF(A8=1302,$G$1&"\r","")&IF (C8<0,C8&"\r","")&IF(J8="Y",J8&"\r","")&IF(J8="N" ,J8&"\r","")&IF(A8<0,IF(D8<0,D8&"\r",""),"")&IF( F8<0,F8&"\r","")&IF(G8<0,G8*-100&"\r","")&IF(F8=11302,$G$1&"\r","")&IF(F8=1302, $G$1&"\r","")&IF(H8<0,H8&"\r","")&IF(K8="Y",K8&"\ r","")&IF(K8="N",K8&"\r","")&IF(F8<0,IF(D8<0,D8& "\r",""),"")
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Ignoring cells using IF

Wow, that is pretty confusing. I'm not sure if this will help, but I would
suggest making your own Custom Function in VBA. You could start it like this:

Public Function myFunction(cell1 As Range, cell2 As Range, cell3 As Range,
cell4 As Range)

'cell1 could be A8
'cell2 could be B8
'cell3 could be C8
'etc

If IsEmpty(cell2) = False Then

If cell1 < 0 Then
cell1 = cell1 & "\r"
Else
cell1 = ""
End If

If cell2 < 0 Then
cell2 = cell2 * 100 & "\r"
Else
cell2 = ""
Else

'the rest of your code using if then statements

Else
cell1 = ""
End If

End Function

In whatever cell you want the result in just type this. arg1, arg2, arg3,
arg4 are cells you want to use in the function I typed above.

=myFunction(arg1,arg2,arg3,arg4)

I hope this helps!
--
Cheers,
Ryan


"Hamed parhizkar" wrote:

I have a really long formula that works perfectly except for one thing. Here
is the formula below, it looks complicated but its just the same couple
formulas over and over for different cells. One thing I am trying to do is if
b8= "" or 0, then I want the output to ignore A8 otherwise let the formula
continue. So basically if there is nothing in B8 then I dont want the output
to spit out the contents in A8.

=IF(A8<0,A8&"\r","")&IF(B8<0,B8*100&"\r","")&IF( A8=11302,$G$1&"\r","")&IF(A8=1302,$G$1&"\r","")&IF (C8<0,C8&"\r","")&IF(J8="Y",J8&"\r","")&IF(J8="N" ,J8&"\r","")&IF(A8<0,IF(D8<0,D8&"\r",""),"")&IF( F8<0,F8&"\r","")&IF(G8<0,G8*-100&"\r","")&IF(F8=11302,$G$1&"\r","")&IF(F8=1302, $G$1&"\r","")&IF(H8<0,H8&"\r","")&IF(K8="Y",K8&"\ r","")&IF(K8="N",K8&"\r","")&IF(F8<0,IF(D8<0,D8& "\r",""),"")

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
Ignoring blank cells Neil Excel Discussion (Misc queries) 3 September 14th 07 04:07 PM
Ignoring Formulas within cells jimswinder Excel Worksheet Functions 8 July 21st 06 02:52 PM
Ignoring Blank Cells Reefaman Excel Worksheet Functions 2 June 11th 06 05:43 PM
Ignoring empty cells beeo Excel Discussion (Misc queries) 3 September 8th 05 09:57 AM
Ignoring cells with no value louis2112[_4_] Excel Programming 3 April 23rd 04 11:34 PM


All times are GMT +1. The time now is 03:21 AM.

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

About Us

"It's about Microsoft Excel"