Merge and center rows whose value is same

I want to merge and center the Rows for which value is same after adding rows in excel what can I Do?
So basically these data is coming from the data table no I have to merge the rows which have same value


Did you happen to try this


Not yet , I have to merge those cell whose value is same

Hi @Parul_Yadav

the above code provided is to merge the cells itself


In that solution it is assign the “cells to merge” but I don’t have that kind of data I am not aware which cell I have to merge , I have extracted data with scrapping ,adding data rows with the Filteration at the end I want to merge and center only those rows whose data is same .


That completes the question now

Please follow below steps

  1. Read the data into datatable(dt)
  2. Use Sort datatable to first get all the similar values together(Step 2 and 3 are to be performed only if data is not already sorted)
  3. Now paste the data back
  4. From the datatable delete the third column and use Remove duplicates(This will give all unique values of row 1 and 2 together)
  5. Now loop through datatable and use find/replace excel activity(with search on Currentrow(2).Tostring) which gives you the cell numbers.
  6. Take the first and last cell numbers and pass it to the code I gave
  7. For getting first column cells replace B with A and you have the first and last cell again for first column as well


Not working


Can you share what you did or what is not working


Hi @Parul_Yadav ,

Take a look on this. it will help to merge.