Inside a complex Excel2010 formula, is there a way to embed a comment “within a section of the complex formula”, so that certain sections (for example, IF-THEN statements) can be commented; allowing on-the-fly analysis of the formula?
I’ve read this post (How to add comment inside complex excel formula) which covers the basic function of adding comment text to the overall cell with “+N()”, but I’m looking for a way to have multiple comments within the formula – similar to REM statements in a DOS batch file, or single-quote comments in VBA code.
Example – my formula (in a basic form):
=IF($C69="","cust is blank", IF($AL69<>"#", IF(MONTH($AL69)=$I$5, "CM","err"), IFERROR(IF(MONTH($AI69+INDEX('Check Grades'!$A$108:$D$112,MATCH($C69,'Check Grades'!$A$108:$A$112,0),4))=$I$5, "NM (late)", "NM (DGI)" ), "no DGI" ) ) )
I’d like to input comments for each IF section, if at all possible:
=IF($C69="","cust is blank", *If C69 is blank, then customer not listed* IF($AL69<>"#", *If AL69 is NOT blank, then check for a valid month* IF(MONTH($AL69)=$I$5, "CM","err"), IFERROR(IF(MONTH($AI69+INDEX('Check Grades'!$A$108:$D$112,MATCH($C69,'Check Grades'!$A$108:$A$112,0),4))=$I$5, "NM (late)", "NM (DGI)" *If AI69 plus a lookup value = I5, 'late' else 'on-time'* ), "other" ) ) )
It looks like the +N() function works simply ‘after’ a formula. Yes, I can (& for the time being, will) split each section into different cells, but in the end, I’ll need to combine them. During development of the complex formula, the comments can help me debug, and when all is done, I can paste them all into an external comment; but still, if this multi-comment-in-a-cell is possible, would like to use…
I would recommend spliting the complex formula into multiple parts/cells.
But if that is not an option, you can use the N() function in multiple locations, where the returned “0” value will not make a calculation/logical error.
I admit, I didn’t study your formula to understand, if this is the case. I leave that privilege to you.
Here is an example of multiple N() functions not messing things up.
=N("Let me tell you a story,")+(SUM($B$2:$B$3)+N(" about a handful of comments,"))/COUNT($C$2:$C$5)+N(" that went to SO.")
The result is correct = 0+(20+0)/4 + 0 = 5.