Hi All excel Legends,
This is my second post to this forum after Narayank991 effortlessly solved my first.
But I think this one is a little more curly...
I am creating SAP(database / business information system) upload sheets in excel, these are maintenance task lists and work plan data.
Part of the data includes relationships between the task lines (rows) eg. this task can't start until the last has completed or they start together...
I am trying to show a Gantt style representation in one of the cells, but the only way I can do it it to use an array formula as the ranges overlap on occasion and I need to return the last row match to get the correct answer.
This is the formula, which works perfectly, when entered and then activated manually (Ctrl, Shift and Enter);
Range("AI" & i).FormulaR1C1 = _
"=IF(RC4<>"""",IF(RC30="""",REPT(""|"",RC[-16]),IF(RC[-3]=""SS"",REPT("" "",INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),21)-INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),6)+RC[-4])&REPT(""|"",RC[-16]),IF(RC[-3]=""FS"",REPT("" "",INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),21)+RC[-4])&REPT(""|"",RC[-16]),""""))),IF(RC[-5]="""",REPT("" "",SUM(R[-1]C[-1],RC[-4]))&REPT(""|"",RC[-16]),IF(RC[-3]=""SS"",REPT("" "",INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),21)-INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),6)+RC[-4])&REPT(""|"",RC[-16]),IF(RC32=""FS"",REPT("" "",INDEX(R[-9]C[-21]:R[1]C[-1],MATCH(9999999999,IF(R[-9]C[-21]:R[1]C[-21]=RC[-5],1,NA())),21)+RC[-4])&REPT(""|"",RC[-16]),""""))))"
Range("AI" & i).Font.Name = "System"
As you can see it is in the range of 1000 chars, and there's no way I can enter it via VBA(256 limit).
This is the work book
https://www.dropbox.com/s/0702ixohl0zaes1/CMFPMDT1.xlsb
If there's some way of getting this formula down under the 256 chars limit, or some way to get the existing formula the work via VBA, I would be eternally grateful...

