+ Reply to Thread
Results 1 to 8 of 8

Fill across with formulas using INDIRECT?

  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Fill across with formulas using INDIRECT?

    Hello, I am new to the forum and I hope you can help...

    I am trying to fill across a formula - =IF(ISBLANK(M4),"",IF(M4=6,0,IF(M4=5,1,IF(M4=4,2,IF(M4=2,4,IF(M4=1,5,IF(M4=0,6)))))))

    However when filling across, I need it to change the row number instead of the column. My search on the web has suggested I use INDIRECT, but I am not sure how to apply it to my spreadsheet (attached)...
    Book2.xls

    Could someone explain please? with instructions to suit a beginner?

    Many thanks!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Fill across with formulas using INDIRECT?

    First, let's simplify that formula a bit...

    Try
    =IF(M4="","",6-M4)

    Now to make the row incriment when filling accross, add in the offset and columns functions.
    =IF(OFFSET($M$4,COLUMNS($A$1:A$1)-1,0)="","",6-OFFSET($M$4,COLUMNS($A$1:A$1)-1,0))

    DO NOT adjust the $A$1:A$1 References, they are not related to your data.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,711

    Re: Fill across with formulas using INDIRECT?

    Or, if you want a non-volatile formula:

    =IF(INDEX($M:$M,COLUMNS($A:A)+3)="","",6-INDEX($M:$M,COLUMNS($A:A)+3)

    then copy across.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    06-12-2013
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Fill across with formulas using INDIRECT?

    Quote Originally Posted by Pete_UK View Post
    Or, if you want a non-volatile formula:

    =IF(INDEX($M:$M,COLUMNS($A:A)+3)="","",6-INDEX($M:$M,COLUMNS($A:A)+3)

    then copy across.

    Hope this helps.

    Pete
    I'm getting errors with this one, but probably user error not the formula
    Last edited by ohnomis; 06-12-2013 at 05:54 PM.

  5. #5
    Registered User
    Join Date
    06-12-2013
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Fill across with formulas using INDIRECT?

    Quote Originally Posted by Jonmo1 View Post
    First, let's simplify that formula a bit...

    Try
    =IF(M4="","",6-M4)

    Now to make the row incriment when filling accross, add in the offset and columns functions.
    =IF(OFFSET($M$4,COLUMNS($A$1:A$1)-1,0)="","",6-OFFSET($M$4,COLUMNS($A$1:A$1)-1,0))

    DO NOT adjust the $A$1:A$1 References, they are not related to your data.
    Many thanks for this... although I don't understand it, it works and I can move on...

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,711

    Re: Fill across with formulas using INDIRECT?

    Quote Originally Posted by ohnomis View Post
    I'm getting errors with this one, but probably user error not the formula
    Yeah, sorry, there should be another bracket at the end.

    =IF(INDEX($M:$M,COLUMNS($A:A)+3)="","",6-INDEX($M:$M,COLUMNS($A:A)+3))

    Glad you got it working.

    Pete

  7. #7
    Registered User
    Join Date
    06-12-2013
    Location
    Newcastle, England
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Fill across with formulas using INDIRECT?

    Quote Originally Posted by Pete_UK View Post
    Yeah, sorry, there should be another bracket at the end.

    =IF(INDEX($M:$M,COLUMNS($A:A)+3)="","",6-INDEX($M:$M,COLUMNS($A:A)+3))

    Glad you got it working.

    Pete
    Ah... great, thanks Pete.

    Out of interest, what if I wanted to fill down, and change the column instead of row... how would the formula look?

  8. #8
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,711

    Re: Fill across with formulas using INDIRECT?

    Well, you would have a row reference instead of $M:$M and you would use ROWS($1:1)+start_number instead of the COLUMNS term.

    Hope this helps.

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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