ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Query content of merged cells (https://www.excelbanter.com/excel-worksheet-functions/222520-query-content-merged-cells.html)

Lucio Menci

Query content of merged cells
 
Hi,

I have cells B1:E1 merged, and F1:K1 merged and so on.
In the rest of my sheet I have formulas that have to refer to the content of
first row.
If the formula refers to B1, it runs, but if it refers to C1 or D1, it
doesn't run.

In the past, I had all merged range with the same number of cells, then,
instead of C1, I putted
OFFSET($A$1,1,INT((COLUMN(B1)-2)/4)*4+1)
but it isn't always true.

joel

Query content of merged cells
 
Use Row 2 instead of Row 1 to compute your offsets

from
OFFSET($A$1,1,INT((COLUMN(B1)-2)/4)*4+1)

to
OFFSET($A$2,0,INT((COLUMN(B2)-2)/4)*4+1)


"Lucio Menci" wrote:

Hi,

I have cells B1:E1 merged, and F1:K1 merged and so on.
In the rest of my sheet I have formulas that have to refer to the content of
first row.
If the formula refers to B1, it runs, but if it refers to C1 or D1, it
doesn't run.

In the past, I had all merged range with the same number of cells, then,
instead of C1, I putted
OFFSET($A$1,1,INT((COLUMN(B1)-2)/4)*4+1)
but it isn't always true.


Lucio Menci

Query content of merged cells
 
It's easier than it could appair...
Thank you

"Joel" wrote:

Use Row 2 instead of Row 1 to compute your offsets

from
OFFSET($A$1,1,INT((COLUMN(B1)-2)/4)*4+1)

to
OFFSET($A$2,0,INT((COLUMN(B2)-2)/4)*4+1)


"Lucio Menci" wrote:

Hi,

I have cells B1:E1 merged, and F1:K1 merged and so on.
In the rest of my sheet I have formulas that have to refer to the content of
first row.
If the formula refers to B1, it runs, but if it refers to C1 or D1, it
doesn't run.

In the past, I had all merged range with the same number of cells, then,
instead of C1, I putted
OFFSET($A$1,1,INT((COLUMN(B1)-2)/4)*4+1)
but it isn't always true.


Bernd P

Query content of merged cells
 
Hello Lucio,

If you want your type of formula I suggest to take
=OFFSET($A$1,0,INT((COLUMN(B$1)-2)/4)*4+1)

But if you want to have a non-volatile function (that is: a function
which does not recalculate each and every time you press F9):
=INDEX($1:$1,0,FLOOR((COLUMN(B$1)-2),4)+2)

OFFSET is volatile, INDEX is not. BTW: FLOOR does exactly what you
introduce with INT(x/4)^4.

Regards,
Bernd


All times are GMT +1. The time now is 12:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com