How to check if cell is the last one in an Excel column -
this question has answer here:
- error in finding last used cell in vba 10 answers
i populating sheets database results. don't know how many rows result have. want have sheet variable number of rows has like:
if(this last row?, sum of previous cells, value)
is there formula determining row last one? looking excel formula not vba code. maybe similar lookup or index or offset not aware of.
you can try udf:
function islastcellinrow(mycell range) boolean if isempty(mycell) exit function if mycell.end(xldown).row = mycell.entirecolumn.rows.count islastcellinrow = true end if end function
the function checks if there non-empty cells below given cells , return true of false.
you can use udf this:
=if(islastcellinrow(sheet1!a1),sum(sheet1!a:a), "whatever")
Comments
Post a Comment