Dynamically changing cell in Excel

i have previous month name in a cell in excel sheet and i want to change it to current month while running the Bot ,but the cell in which month is there is changing dynamically.Sometimes it is in B5 and sometimes in D2 etc.How to handle this .Anyone’s help is appreciated.Also the data is in unstructured format and when i read into datatable format is missing

@navateja27 If the cell value will be same or it will change?


So the value is always previous month’s and whats the format for the month value it is displaying??

You can search each cell individually for the specific date and if you find it you can change it.

Use For Each Row activity to loop through every row, then use For Each activity with Type Object and loop through DataTable.Column.

After that you can loop thought each cell.

Make IF statment with Expression to match current date, if that match is true, then you can override the value of the cell (Since you know the row and column position)

You can use DateTime.Now.AddMonths(-1).toString(Format) to match the value of the previous month

it will change everytime

@AryanSingh it may or mayn’t be always it may be 2 months prior to it also and the format is just the month name as-April ,May


Can you please share the screenshot of the whole column??

the cells may vary(they wont be in the 10th and 19th row always)and we need to update them with current and previous months