Code to fill formula in merged cells & unmerged cells

ExcelRoy

Well-known Member
Joined
Oct 2, 2006
Messages
2,540
Office Version
  1. 365
Platform
  1. Windows
Hi all,

Hope you can help

I am looking for a some code to enter formula in cells J13:J2011

I am looking for the following

J13 (merged with J14)
=IF(Update!L3="","",Update!L3)

J15 (Merged with J16)
=IF(Update!L4="","",Update!L4)

J17 (merged with J18)
=IF(Update!L5="","",Update!L5)

etc etc

I know merged cells isn't the answer but it achieves what i need
Simpel dragging down teh firmual jumps from L3>L7 etc missing critical data

Many thanks for any help
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Merged cells are evil. Do not use them. This is one reason why. You have not shown your data but there is always a better way to design your layout than to use merged cells.

Here is a formula that will work on your highly undesirable format.
Excel Formula:
=LET(U,INDEX(Update!L:L,(ROW()-13)/2+3),IF(U="","",U))
 
Upvote 0
Solution
Wow, wont even begin to work out how this works but perfect thanks!
 
Upvote 0
LET is a new function that allows you to assign an expression to a variable so you can use that variable in your formula instead of repeating a long expression more than once. The variable U represents the expression

Excel Formula:
INDEX(Update!L:L,(ROW()-13)/2+3)

which returns the desired cell on Update.

INDEX returns a cell, based on a range of cells and a row and column within that range. Update!L:L contains all the cells you want to reference. ROW() is the row number for where this formula is. If we do the arithmetic (13 is the first row containing your formula, 3 is the first row to reference in Update):

(ROW()-13)/2+3

Then you get:
Row number of formulaResult of expression
133
154
175

and so on.

So the formula says if the referenced cell (U) is blank, then return a blank result, otherwise return U.
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,363
Members
449,097
Latest member
thnirmitha

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