04-10-2010, 10:50 PM
May be good time for old school logic primer...
A ) There is usually more than one way to skin a cat, so start with any unique results, then work your way through the multiples, compounds, conditionally exclusives, etc., down through the default.
B ) It helps to write out each individual logical component in its most basic form(s), and test it/them separately in hierarchal order first.
C ) After you have established that your individual logical components function properly, combine them one at a time, and check to make sure each successive combination works properly before continuing.
D ) After you have created a functioning compound logical statement, you can then work on streamlining it or making it more elegant and efficient.
This usually allows you to get up and running faster, so you at least have a working solution in hand from which to start optimizing. The most basic logical "B )" components in hierarchal order here were:
If C12 = "Close" then Q12 = 7
If C12 = "Short" then Q12 = 7
If C12 <> "Close" and If C12 <> "Short" then Q12 = 0
If C12 is empty [or for any and all other conditions not listed above] Q12 = 0
There are four distinct options here, noting that the fourth, and last, is the default provided when all other viable options have failed. Assuming you account for other stray stuff in 'C12', so that you are really only looking for 'Close' or 'Short' there, the "C )" assembly would be;
IF(C12 = "Close", 7, IF(C12 = "Short", 7, IF(AND(C12 <> "Close", C12 <> "Short"), 0, 0 ) ) )
After you get working logic that accounts for all of your conditions in proper hierarchal order, then you can streamline for efficiency and elegance as stated in 'D )', rather than starting with 'D )'...
A ) There is usually more than one way to skin a cat, so start with any unique results, then work your way through the multiples, compounds, conditionally exclusives, etc., down through the default.
B ) It helps to write out each individual logical component in its most basic form(s), and test it/them separately in hierarchal order first.
C ) After you have established that your individual logical components function properly, combine them one at a time, and check to make sure each successive combination works properly before continuing.
D ) After you have created a functioning compound logical statement, you can then work on streamlining it or making it more elegant and efficient.
This usually allows you to get up and running faster, so you at least have a working solution in hand from which to start optimizing. The most basic logical "B )" components in hierarchal order here were:
If C12 = "Close" then Q12 = 7
If C12 = "Short" then Q12 = 7
If C12 <> "Close" and If C12 <> "Short" then Q12 = 0
If C12 is empty [or for any and all other conditions not listed above] Q12 = 0
There are four distinct options here, noting that the fourth, and last, is the default provided when all other viable options have failed. Assuming you account for other stray stuff in 'C12', so that you are really only looking for 'Close' or 'Short' there, the "C )" assembly would be;
IF(C12 = "Close", 7, IF(C12 = "Short", 7, IF(AND(C12 <> "Close", C12 <> "Short"), 0, 0 ) ) )
After you get working logic that accounts for all of your conditions in proper hierarchal order, then you can streamline for efficiency and elegance as stated in 'D )', rather than starting with 'D )'...