Excel: Converting algorithm to formula ( embedded IF AND )

Morning, I have the following algorithm:

The part I have bolded repeats infinitely afterwards. I need to convert this into an excel formula. Where a 'Y' occurs, I want excel to return me the value in cell C2. I have the following formula: =IF(AND($D$7<>0,OR(D$3=$B5,C$3=$B5,D5+C5+B5=(2*$C$2))),$C$2,0) which gives me the NYYY, NYYY, NYYY etc. I have done this by saying if the previous month's column cell = the current month's row cell, return a value to get the first 'NY' part. I then repeated this to get to 'NYY', then have the condition that if the sum of the previous 3 cells = 2*the value in C2, give me a value to get NYYY, NYYY, NYYY etc. I need to add in something to get that first part of the algorithm above (not in bold). Any suggestions? Thank you

This question generated 38 answers. To proceed to the answers, click here.

This thread is current as of October 15, 2013.

For more resources for Microsoft Excel