Just to let you know that I modified your messages to remove the smileys. There is an option in the "Additional options" link which says "Don't use smileys". It totally makes sense when posting formulae.
After removing the smileys it becomes obvious that londolozi did close all the brackets.
However, londolozi is mixing up the MF Pro and Excel syntax incorrectly here. To obtain the values of the cells in column P, you must refer to them with the corresponding trigger variable which ought to have the following syntax:
cell_[sheet_name]_[cell_address]
So your original notation transforms into:
IF(AND(cell_querymarket_id_P(sel_index*3+1)>0,cell_querymarket_id_P(sel_index*3+1)<8),1,0)
You indeed can include any Excel formula in a custom cell, but in that case you must put an equation sign in front of it:
=SUM(B(sel_index*3+1):D(sel_index*3+1))
So how come this expression is parsed correctly and your formula is not?
The thing is, before transferring the body of the custom cell formula to Excel, MF Pro will parse as much of the expression as it can. It will substitute every operator, function, variable etc. it can with the corresponding value.
So take this formula:
=SUM(B(sel_index*3+1):D(sel_index*3+1))
The word SUM is unknown to MF Pro, yet it does replace the variable sel_index with a number, and it does perform the arithmetic calculation. So the bit that goes on to the spreadsheet will look like this:
=SUM(B4:D4)
The rest is done by Excel, i.e. Excel calculates the sum of this cell range.
Now take a look at this:
IF(AND(P(sel_index*3+1)>0,P(sel_index*3+1)<8),1,0)
Since IF and AND can be parsed by MF Pro, their syntax will be expected from your expression. After replacing the variables and performing the arithmetics this is what will remain:
IF(AND(P4>0,P4<8),1,0)
The program will now do the comparison: P4 is between 0 and 8? No, it is false, because to MF Pro, P4 is a combination of a letter and a digit, not a cell. Therefore the whole expression will always return 0. And it is 0 that will be passed on to Excel.
Putting the equation sign in front of IF will not help in this case, it will only result in "=0" being passed to the spreadsheet, again, because IF and AND will be parsed by the program, not by Excel.
Gosh, this makes such a long post, but I hope I've managed to clear it up a bit.