+ Reply to Thread
Results 1 to 5 of 5

Combining index, address, reference-type formulae

Hybrid View

  1. #1
    Registered User
    Join Date
    07-27-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Combining index, address, reference-type formulae

    Hi,

    Please see the attachment.

    The file is a combination of several txt files, each one with the same header (of 4 lines), and the same format.

    The purpose of the sheet is to calculate the offset in the X and Y direction from the origin. This is calculated by subtracting each row's values from the origin. If I just did it for one, I could obviously use the $ to tell the formula to keep the cell reference static.

    However, with several of these combined files (there are 160 in my real file), it wouldn't work as I would need to move the static cell reference each time I moved past a new header (onto a new object).

    Is there some way to use the row reference to make the static reference stay on the first row of each dataset? (i.e. at the bottom of each header, and at the first XY point)


    Please ask if you need clarification, its hard to explain!
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Combining index, address, reference-type formulae

    cmboulter,

    In cell D1:
    =IF($A2="ORIGIN",IF(COLUMN()=4,"Xoffset","Yoffset"),IF(OR($A1="ORIGIN",ISNUMBER($A1)),LOOKUP(2,1/($A$1:$A1="ORIGIN"),B$1:B1)-B1,""))

    Then copy to cell E1, then copy down
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Combining index, address, reference-type formulae

    Maybe:

    =IF(AND(A5<>"Header row 1",A5<>"Date"),IFERROR(INDIRECT("$B"&MATCH("Building "&COUNTIF($A$1:A5,"ORIGIN"),B:B,0)+3)-INDIRECT("B"&ROW(B5)),""),"")

    for the X offset.

    Similar for the y offset.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    07-27-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Combining index, address, reference-type formulae

    Perfect!

    Thank you!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,196

    Re: Combining index, address, reference-type formulae

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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