I want to display something in col 1 as following:
Unique Identifier Display_Reg Year Month Region LO Count
2016_Apr_ENY ENY 2016 Apr Albany 10
2016_Mar_ENY ENY 2016 Mar Albany 11
I am getting values in Cells of col 1 as:
worksheet_LO.Cells[Rowcount, 1].Formula = "=CONCATENATE(C" + Rowcount + "," +"D" + Rowcount + "," + "B" + Rowcount + ")";
worksheet_LO.Cells[Rowcount, 1].Calculate();
Above gives me result as 2016AprEny. How to Display Underscore among them.
The Goal is to end up with this formula in the cell:
=CONCATENATE(C1,"_",D1,"_",B1)
To achieve this you need to add the ,"_",
string into your concatenation where you had just the ,
. in order to do this we need to be careful to escape the "
character by adding another in front.
This should do it:
worksheet_LO.Cells[Rowcount, 1].Formula = "=CONCATENATE(C" + Rowcount +@",""_"","+"D" + Rowcount + @",""_""," + "B" + Rowcount + ")";
worksheet_LO.Cells[Rowcount, 1].Calculate();