Help with epplus formulas (Excel) c #

0

I'm doing an excel in which I made some formula, but when I take a cell that is the result of a formula, to use it in another formula it shows me in the cell literally the formula.

As it is highlighted in the colors yellow is the range of providers L , blue is the cell in the column O , and in green is the range of that there is in the K column that is called AMOUNT

This is the code:

  string SUMA_SI_MONTO = celda + ":" + comparativo.Cells[(columna1 + i), (columna + 2)]; // K7:K8 MONTO

                string SUMA_SI_PROVEE = celda_Final + ":" + comparativo.Cells[(columna1 + i), (columna + 3)];// L7:L8 PROVEEDOR

                comparativo.Cells[(columna1 + i + 1), (columna + 2)].Formula = SUMA;// PRECIO AUTORIZADO
                for (int q = 0; q < proveedor.ToList().Count(); q++) {

                    // =SUMAR.SI(T7:T46,W7,S7:S46)
                    string _SUMA_SI = "=SUMAR.SI(" + SUMA_SI_PROVEE + "," + comparativo.Cells[(provedor_cont - 4) + q, (cont + 6)] +"," + SUMA_SI_MONTO + ")";
                    comparativo.Cells[(provedor_cont - 4) + q, (cont + 7)].Value = _SUMA_SI; // =SUMAR.SI(L7:L9,O10,K7:K9)

                }

And apparently only the formula is concatenating me. I have to enter the editing mode of the cell and leave it to show me the result.

Someone who has happened the same to help me?
Thanks.

    
asked by JuanL 29.06.2018 в 00:13
source

1 answer

0

I could solve it, apparently always indicated to the cell as a value when it should be as formulated.

As I have it.

comparativo.Cells[(provedor_cont - 4) + q, (cont + 7)].Value = "=SUM(B1:B3)";

How it should be

comparativo.Cells[(provedor_cont - 4) + q, (cont + 7)].Formula = "=SUM(B1:B3)";

Thank you!

    
answered by 28.12.2018 в 17:24