Copy value from cell above if blank

Mux99

Board Regular
Joined
Apr 15, 2019
Messages
57
In column A every two cells are merged (A1 with A2, A3 with A4 etc...) so my formula only works properly for odd number rows. I need the below to use the value from the cell above if A6 is empty and so on.

=IF(Sheet1!$B6<>"", Sheet1!$A6,"")
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Maybe:
Code:
=IF(Sheet1!$B6<>"", IF(MOD(ROW(Sheet1!A6),2)=0,Sheet1!$A5,""))
 
Upvote 0
Maybe
=IF(Sheet1!$A6="",Sheet1!$A5,Sheet1!A6)
 
Upvote 0
Maybe
=IF(Sheet1!$A6="",Sheet1!$A5,Sheet1!A6)

Also did not work for what I'm trying to do but maybe it's my fault as maybe I wasn't clear enough with what I need. Ignore my first post and see the examples below. I need a formula to output the same results as in Sheet2.

In Sheet2 Column B I'm using the formula and it works perfectly. =IF(Sheet1!$B1<>"", Sheet1!$B1,"")

I need some help with the column A formula as the following only works with odd number rows. =IF(Sheet1!$B1<>"", Sheet1!$A1,"")


[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Sheet1[/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Name1[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Name2[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Name3[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD][/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Name4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD][/TD]
[TD]400[/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Sheet2[/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Name1[/TD]
[TD]500[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Name3[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Name3[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Name4[/TD]
[TD]400[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
In cell A1 of Sheet2, try this formula and copy down.

=IF(Sheet1!B1="","",LOOKUP("zzz",Sheet1!A$1:A1))
 
Upvote 0
In cell A1 of Sheet2, try this formula and copy down.

=IF(Sheet1!B1="","",LOOKUP("zzz",Sheet1!A$1:A1))

Thanks. This one worked but I already got it working with the formula below.

=IF(Sheet1!$B2<>"",IF(Sheet1!$A2<>"",Sheet1!$A2,Sheet1!$A1),"")
 
Upvote 0
Thanks. This one worked but I already got it working with the formula below.

=IF(Sheet1!$B2<>"",IF(Sheet1!$A2<>"",Sheet1!$A2,Sheet1!$A1),"")
That sort of indicates that in fact your data & results probably actually start on row 2 of each sheet, not row 1 as indicated in your tables in post 5? (Or else that formula is entered on row 2 of Sheet2 and copied up to row 1 which, while working actually creates a #REF ! error in the formula.

If everything (apart from any headings) actually starts on row 2, then you could also use this simpler version in A2 of Sheet2, copied down

=IF(Sheet1!B2="","",Sheet1!A1&Sheet1!A2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top