Enable insertion of columns and retain formula

ozbeachbum

Board Regular
Joined
Jun 3, 2015
Messages
221
Office Version
  1. 2021
Platform
  1. Windows
I have the following formulas but need to insert columns within the range from time to time, however when I do the formulas return VALUE.
Is there another formula or adjustment to these formula that will eliminate the issue?

Destination Cell AF48
='Monies Drawn Down'!M6+AN46
+SUMPRODUCT(--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0),T59:LN59)
+SUMPRODUCT(--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0),'COM BID Off Pur'!T59:LN59)


Destination Cell AF51
=SUMPRODUCT(--(MOD(COLUMN(V59:LN59)-COLUMN(V59)+1,46)=0),V59:LN59)
+SUMPRODUCT(--(MOD(COLUMN(V59:LN59)-COLUMN(V59)+1,46)=0),'COM BID Off Pur'!V59:LN59)

I seem to be able to only place the one mini sheet, trust it helps

240903 20 CHRONICLE mrxl.xlsx
TUVWAEAFAGAHBJBKBLBMBNBOBPBQ
21234121314154344454647484950
4816
49
50
5113
52
58
5913
HOLD CUR Off Acq Pur Sel
Cell Formulas
RangeFormula
U2:W2,AE2:AH2,BJ2:BQ2U2=T2+1
AF48AF48='Monies Drawn Down'!M6+AN46 +SUMPRODUCT(--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0),T59:LN59) +SUMPRODUCT(--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0),'COM BID Off Pur'!T59:LN59)
AF51AF51=SUMPRODUCT(--(MOD(COLUMN(V59:LN59)-COLUMN(V59)+1,46)=0),V59:LN59) +SUMPRODUCT(--(MOD(COLUMN(V59:LN59)-COLUMN(V59)+1,46)=0),'COM BID Off Pur'!V59:LN59)
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
The COLUMN(T59:LN59)-COLUMN(T59)+1 part just returns the numbers you already have in row 2, so I don't know why you don't just use those?
 
Upvote 0
Try In AF48
Excel Formula:
=INDIRECT("'Monies Drawn Down'!M46")+INDIRECT("AN46") +SUMPRODUCT(--(MOD(COLUMN(INDIRECT("T59:LN59"))-COLUMN(INDIRECT("T59"))+1,46)=0),INDIRECT("T59:LN59")) +SUMPRODUCT(--(MOD(COLUMN(INDIRECT("T59:LN59"))-COLUMN(INDIRECT("T59"))+1,46)=0),INDIRECT("'COM BID Off Pur'!T59:LN59"))
Since this formula passive function (INDIRECT) it may sloe down the excel.
 
Upvote 0
The COLUMN(T59:LN59)-COLUMN(T59)+1 part just returns the numbers you already have in row 2, so I don't know why you don't just use those?
Hi,
I tried what I understood your suggestion to be with no luck.
Would you be good enough to provide more detail and I will give it another try.
Cheers.
 
Upvote 0
I mean you would replace this part of the formula:

Excel Formula:
--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0)

with:

Excel Formula:
--(MOD(T2:LN2,46)=0)

so for example, AF48 becomes:

Excel Formula:
='Monies Drawn Down'!M6+AN46
+SUMPRODUCT(--(MOD(T2:LN2,46)=0),T59:LN59)
+SUMPRODUCT(--(MOD(T2:LN2,46)=0),'COM BID Off Pur'!T59:LN59)
 
Upvote 0
Is the formula in AF51 supposed to ignore columns T:U?
 
Upvote 0
I mean you would replace this part of the formula:

Excel Formula:
--(MOD(COLUMN(T59:LN59)-COLUMN(T59)+1,46)=0)

with:

Excel Formula:
--(MOD(T2:LN2,46)=0)

so for example, AF48 becomes:

Excel Formula:
='Monies Drawn Down'!M6+AN46
+SUMPRODUCT(--(MOD(T2:LN2,46)=0),T59:LN59)
+SUMPRODUCT(--(MOD(T2:LN2,46)=0),'COM BID Off Pur'!T59:LN59)
Hi Rory,
Thanks for taking the time to help me.

Starting with your question "Is the formula in AF51 supposed to ignore columns T:U?" Yes it is.
For the result in AF51 what I was having the formula do was to SUM each 46th cell starting at "BO"
For the result in AF48 what I was having the formula do was to SUM each 46th cell starting at "BM"

With reference to the formula you so kindly provided row 2 is only a count to show the column number for reference to the formula,
EG: T:BM is 46 spaces and V:BO is 46 spaces.

I adjusted the formula as follows, however it returned VALUE.
='Monies Drawn Down'!M6+AN46
+SUMPRODUCT(--(MOD(T59:LN59,46)=0),T59:LN59)
+SUMPRODUCT(--(MOD(T59:LN59,46)=0),'COM BID Off Pur'!T59:LN59)

Thanks once again for all your time,
Cheers,
Dave.
 
Upvote 0
That is not going to work. If you can't use the values in row 2 for some reason, you need to go back to the version with COLUMN in it.

It might be better to ask why your formula is doing what it's doing - why do you need every 46th column? Whenever I see a formula like this, it tends to be due to a worksheet layout that is less than ideal... ;)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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