I am working with a list of data where one or multiple cells in a row can be blank.
Lets say the list is cells A1
, A2
, A3
, A4
. I am trying to create a function that will do the following:
IF A1 has a value I want the cell to return A1.
IF A1 is empty then I want it to return A2.
IF A1 and A2 are both empty I want it to return A3.
If A1, A2 and A3 are all empty I want it to return A4.
This did the trick for me
Source credit: here
You can just put a
rank.eq
formula in the column next to it, and do avlookup
to bring all of your data to the top. This will bring all of your data to the top.For example, in the image below I am ranking using the percentage, I want to bring the cells with data to the top for presentation, I will hide all columns other than where my
vlookups
are.Select ColumnA:
HOME > Editing > Find & Select > Go To Special... > Blanks, OK, =, ↓, Ctrl+Enter.
As indicated in your comment on your question, you have 500 rows interspersed with blank cells. You want to fill blank cells with the value of the last non blank cell.
I'd write some VBA code that'd work as follows: select the range of cells you want to back fill and run this VBA:
basically, if the cell is empty, use the value of the last non blank cell (if there were no blank cells above, it will remain blank). Else, if the cell is not empty, save this as the last non blank cell. Repeat for every cell in the selected range.
Step by Step instructions on using this vba code - for this sample worksheet:
Make sure the range is selected, press ALT+F11.
This should open the Visual Basic Editor:
Press F7, This should bring up the code for the activesheet. Paste the VB code from above:
Press F5 (or use the menu to run the code).
The end result should be as follows:
first result on google: http://chandoo.org/wp/2014/01/15/find-first-non-blank-item-in-a-list-excel-formulas/
If you need to find non-blank that url gives the following solution: