Fill down in Excel, but based on multiple values
Posted
by Jenn D.
on Super User
See other posts from Super User
or by Jenn D.
Published on 2010-06-10T15:40:15Z
Indexed on
2010/06/10
15:43 UTC
Read the original article
Hit count: 251
excel
I have spreadsheets (not created by me) that have blank entries in one column where they should really have data. I want to take every empty cell and fill it with the nearest value above it. I'm looking for as little manual intervention as possible, because I'll have to do it repeatedly.
I thought some previous version of Excel, or maybe another spreadsheet from the distant past, would do this by default -- that is, if you selected the column with foo and bar, and chose the equivalent of "fill down", you would get what's in the WANT column. What I actually get in Excel is the GET column.
HAVE: WANT: GET:
foo 1 foo 1 foo 1
2 foo 2 foo 2
bar 1 bar 1 foo 1
2 bar 2 foo 2
3 bar 3 foo 3
I'm worried that this might need a macro to be done properly. I used to be a whiz with Excel macros, and then suddenly they were all in VB.
My fallback position will be to dump the whole thing to CSV and write a Python script, but if there's any way to do it in Excel that would be much preferable. Even if it involves a couple of different manual steps, that's fine; just not one step per group of lines. That is, a process of "copy the column, do X to it, cut and paste it back" would work, but "do X for each occurrence of foo or bar" won't. The files are too big for that.
Any thoughts are appreciated!
© Super User or respective owner