I would like to import an Excel spreadsheet, which contains merged cells, unmerge those cells and fill each unmerged cell with the original cell's value divided by the number of unmerged cells. For example, if a merged cell, comprising 4 cells, contains the value 1000 I would like to unmerge and return 250 in each unmerged cell.
I am aware of functions like read.xlsx()
where I can set fillMergedCells = FALSE
; however, this fills each unmerged cell with a duplicate of the merged cell's original value.
Can this be done in R, perhaps somehow using the read.xlsx()
function? Can it be done in Excel VBA? I have no knowledge of VBA so any pointers would be helpful!
Merged
contains before, the sheetDesired result after unmerge
is what I would like to achieve. – geoffest