ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Incrementing by 1 in every other column (https://www.excelbanter.com/excel-worksheet-functions/154037-incrementing-1-every-other-column.html)

Bob

Incrementing by 1 in every other column
 
Cells L3 and M3 are merged cells. The formula in cell L3 is:

=IF(Period_End=COLUMN(L1)-11,VLOOKUP(COLUMN(L1)-11,Period_End_Lookup,2),"")
= May 2007

Cells N3 and O3 are also merged cells. The formula in cell N3 is:

=IF(Period_End=COLUMN(N1)-12,VLOOKUP(COLUMN(N1)-12,Period_End_Lookup,2),"")
= Jun 2007

Notice that I had to hard-code 11 in the 1st formula, and 12 in the second
formula in order for the dates to come out correctly.

Rather than hard-code any numbers, I would prefer to use an algorithm within
the existing formulas that would increment the count by 1 even though the
formulas are located in every other column.

Any help/guidance would be greatly appreciated.

Thanks,
Bob


Elkar

Incrementing by 1 in every other column
 
Try substituting this for the number 11. When copied, it should increment as
you want.

(INT(COLUMN(L1)/2)+5)

HTH,
Elkar


"Bob" wrote:

Cells L3 and M3 are merged cells. The formula in cell L3 is:

=IF(Period_End=COLUMN(L1)-11,VLOOKUP(COLUMN(L1)-11,Period_End_Lookup,2),"")
= May 2007

Cells N3 and O3 are also merged cells. The formula in cell N3 is:

=IF(Period_End=COLUMN(N1)-12,VLOOKUP(COLUMN(N1)-12,Period_End_Lookup,2),"")
= Jun 2007

Notice that I had to hard-code 11 in the 1st formula, and 12 in the second
formula in order for the dates to come out correctly.

Rather than hard-code any numbers, I would prefer to use an algorithm within
the existing formulas that would increment the count by 1 even though the
formulas are located in every other column.

Any help/guidance would be greatly appreciated.

Thanks,
Bob


Bob

Incrementing by 1 in every other column
 
Elkar,
Your formula segment did the trick. Thanks a million!
Bob

"Elkar" wrote:

Try substituting this for the number 11. When copied, it should increment as
you want.

(INT(COLUMN(L1)/2)+5)

HTH,
Elkar


"Bob" wrote:

Cells L3 and M3 are merged cells. The formula in cell L3 is:

=IF(Period_End=COLUMN(L1)-11,VLOOKUP(COLUMN(L1)-11,Period_End_Lookup,2),"")
= May 2007

Cells N3 and O3 are also merged cells. The formula in cell N3 is:

=IF(Period_End=COLUMN(N1)-12,VLOOKUP(COLUMN(N1)-12,Period_End_Lookup,2),"")
= Jun 2007

Notice that I had to hard-code 11 in the 1st formula, and 12 in the second
formula in order for the dates to come out correctly.

Rather than hard-code any numbers, I would prefer to use an algorithm within
the existing formulas that would increment the count by 1 even though the
formulas are located in every other column.

Any help/guidance would be greatly appreciated.

Thanks,
Bob



All times are GMT +1. The time now is 08:44 AM.

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