lmg
lmg

Reputation: 79

Excel find next value in column

I'm probably over-thinking this, but been working on this for hours and can't come up with anything that works.

I have a spreadsheet with the following values:

A       B
205.86  
 63.51  
 81.03  
 54.75  
 35.04  
 94.17  
 48.18  115
 35.04  
 56.94  
 41.61  
  3.99  
 91.77  200
  0.00  
 99.75  
 43.89  
247.38  
 89.82  
124.75  
 84.83  
219.56  
 65.61  
 80.19  
 54.24  206
 98.82  
 65.89  
108.99  210 

AND SO ON FOR APPROX. 5000 ROWS  

I need the next value in Column B to appear in column C as such:

A       B        C
205.86           115
 63.51           115             
 81.03           115  
 54.75           115  
 35.04           115
 94.17           115
 48.18  115      115
 35.04           200
 56.94           200
 41.61           200
  3.99           200
 91.77  200      200
  0.00           206
 99.75           206
 43.89           206
247.38           206
 89.82           206
124.75           206
 84.83           206
219.56           206
 65.61           206
 80.19           206
 54.24  206      206
 98.82           210
 65.89           210 
108.99  210      210

How can this be done, preferably with a formula, but will use a Macro if I have to. Thanks in advance for your help!

Upvotes: 2

Views: 24301

Answers (2)

Gary's Student
Gary's Student

Reputation: 96773

A tiny trick!

In C1 enter:

=IF(B1<>"",B1,C2)

and copy down

Upvotes: 1

Dmitry Pavliv
Dmitry Pavliv

Reputation: 35853

Use this formula in C1:

=IF(B1="",C2,B1)

and drag it down

enter image description here

Upvotes: 8

Related Questions