Filling up blank cells with previous or next value based on a criteria from another column

Copper Contributor

I have a large dataset and there are some cells which are blank. I have to either fill up with previous or next value in the column based on a criteria from another column. For example in the diagram below, I have to fill the empty cells in column B based on the values in column E. If column E2856 is 20, then fill up value using B2855. If E2856 is 21 then B2856 should be filled with the next available value which is in B2868. How do I structure the IF statement to do that or is there any better formula for this? 

Ameer193_1-1633154947412.png

 

Thanks in advance.

 

 

1 Reply

@Ameer193 

 

WynHopkins_0-1633162592286.png

 

I'd add 2 helper columns as per the attached file