Write excel formula for row count

excel

#1

Hi,

Facing problem while trying to set a formula in a desired cell(AZ1) of the sheet. The intention is to get the the last row with values in it, add +1 to it and use the new row to continue writing to the sheet.

Formula : =MATCH(REPT(“z”,255),A:A) + 1

The C# escape sequence doesn’t work over here and unable to assign the same in variable.

Tried to have the formula in Notepad and then copy the contents over to the cell but its giving error like
"System.ServiceModel.FaultException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Would like to have some suggestions over how can this be achieved. After that getcell can be used to use the formula output and continue the automation.

Thanks & Regards,
Vinay Sulanki


Write Cell - Formula Not Calculating
How to add column values in excel
#2

Hi @Vinay ,

Please check the below screenshot for writing formula,

let us know whether this resolves your problem.

Thank You :slight_smile:


How to add New Column with excel formula?
Applied formula on excel removed after adding a new row in excel
#3

@nikitha.hanumanthara the piece of code works, Thanks :slight_smile:

Have slightly modified the formula to give 1 instead of N/A by using IFNA() along with the above code. Don’t know what sorted out the System.ServiceModel.FaultException which I was encountering yesterday.

Thank you for your inputs.


#4

NOT WORKING


#5

Instead of using formula to read row count in Excel try using read excel activity and store output in data table and then use varDatatable.rows.count