Setting Cell Text when existing formula exist?

Posted by: thomas-starkweathercircor-com on 8 September 2017, 3:18 pm EST

  • Posted 8 September 2017, 3:18 pm EST

    I have a cell that the initial spreadsheet has the VLookup function. If this function returns a "NONE" I want to set the sell to some value in code.

    sDescription = fpSpreadCosts.Sheets[0].Cells[rowdetail + rp, col + 2].Text;
    if (((rp > 5 && sDescription.ToUpper() != "NONE") || sDescription == "NO PART FOUND" && sCostOver.Length < 1))
    fpSpreadCosts.Sheets[0].Cells[rowdetail,c].Text = sMaterialDesc;

    The above statement gets ignored and the formula is still in the cell. What is the command needed to remove the formula 1st so the ".Text" works.

  • Replied 8 September 2017, 3:18 pm EST

    =IFERROR(VLOOKUP('Packing Mod Table'!A4,'Packing Mod Table'!$B$1:$F$49,3,FALSE),"NO PART FOUND")

    This is the sample of the formula in the cell.

    fpSpreadCosts.Sheets[0].Cells[rowdetail, col + 2].ResetFormula();

    Does not work..
  • Marked as Answer

    Replied 8 September 2017, 3:18 pm EST


    The ResetFormula is working correctly at my end and the new text is correctly assigned to the respective cell (having the result of the VLOOKUP function).

    Please refer to the attached sample for your reference.

    We tested the issue with the latest build of Spread(8.20.20151.0). Request you to please test with the same and see if you still face the same issue.

    Next, in case the ResetFormula doesn't work for you, we request you to share your sample application with us.

    Meanwhile, a suggested workaround for you is to set the Formula of the respective cell to empty string and then assign the new value to it. This would serve your purpose.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels