+ Reply to Thread
Results 1 to 8 of 8

Copy Formula Horizontally Need to Skip Column

  1. #1
    Registered User
    Join Date
    02-25-2010
    Location
    SD
    MS-Off Ver
    Excel 2008 Mac
    Posts
    12

    Question Copy Formula Horizontally Need to Skip Column

    My formula is adding two bi monthly values to show the total monthly cost. EX: =sum(A1,B1). A1 = January 1 value in $, B1 = January 15 value in $, total = The entire month of January in $.

    The problem is when I drag the formula over to February it changes to =sum(B1,C1) which includes half of January and the first half of February.

    I need the formula to change from =sum(A1,B1) to =sum(C1,D1) etc... 100+ columns in all are affected otherwise I would do this manually each time. How can this be accomplished?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copy Formula Horizontally Need to Skip Column

    Try:

    =SUM(INDEX(1:1,2*(COLUMNS($A$1:A$1)-1)+1),INDEX(1:1,2*(COLUMNS($A$1:A$1)-1)+2))

    copied across.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    02-25-2010
    Location
    SD
    MS-Off Ver
    Excel 2008 Mac
    Posts
    12

    Re: Copy Formula Horizontally Need to Skip Column

    The first calculation I need is =SUM(Payroll!H26:I26) then the next cell =SUM(Payroll!J26:K26) and so on. I translated your solution to the below but it did not work. Is this correct?

    =SUM(INDEX(1:1,2*(COLUMNS(Payroll!$H$26:H$26)-1)+1),INDEX(1:1,2*(COLUMNS(Payroll!$H$26:H$26)-1)+2))

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copy Formula Horizontally Need to Skip Column

    If you want to refer to the whole of row 26 as you are copying across then:

    Please Login or Register  to view this content.
    otherwise, if you can define a definite range size that you will not pass, like H26:Z26, then

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-25-2010
    Location
    SD
    MS-Off Ver
    Excel 2008 Mac
    Posts
    12

    Re: Copy Formula Horizontally Need to Skip Column

    I am still not getting it. Let's say the range terminates at BC26. I have attached a sample report of what I am doing with dummy data but I corresponded the cell locations to my real spreadsheet. Please see the attached. Thanks!
    Attached Files Attached Files

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copy Formula Horizontally Need to Skip Column

    I forgot to prefix the ranges with the Payroll sheetname:

    Try:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-25-2010
    Location
    SD
    MS-Off Ver
    Excel 2008 Mac
    Posts
    12

    Re: Copy Formula Horizontally Need to Skip Column

    Where are the columns A and B coming from? Per my previously attached spreadsheet the two cells I am totally are on a different worksheet. Payroll is the source data with the two columns. Cost is the worksheet I am working in with the calculation. Does this affect the formula?

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Copy Formula Horizontally Need to Skip Column

    I must have copied from the wrong cell.. sorry.

    In the first cell it should be:

    Please Login or Register  to view this content.
    The COLUMNS(Payroll!$A$26:A$26)-1 is a counter, starting with 0, COLUMNS(Payroll!$A$26:A$26) results in 1 and the -1 makes it 0 as you copy across, the second A$26 becomes B$26 (with final result 1), etc... this in turn is multiplied by 2 (the step) and 1 is added to adjust to the right reference... in the second part 2 is added to adjust to the second reference column.

    If you evaluate the formula through Tools|Formula Auditing, you will see the steps it takes.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1