+ Reply to Thread
Results 1 to 14 of 14

Using row function in indirect

  1. #1
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Using row function in indirect

    Hello,

    I have been trying to create a hyperlink that changes which sheet it goes to, according to which row the formula is in. For example, I want to click on cell A10 (which contains ABC), which will take me to cell A1 on sheet ABC. However I also want to be able to copy and paste this hyperlink one or more cells down and have it look at cell A11, A12, etc.

    I know that if I do this:
    #INDIRECT("'"&A10&"'!"&"A1")
    it will work but when I copy and paste it in another cell, the A10 stays the same.

    I tried playing around with this:
    #INDIRECT("'"&"A"&ROW()&"'!"&"A1")
    which doesn't seem to work.

    On its own, "A"&ROW() returns the correct cell, but when it is inside the indirect function, I can't seem to get it to work.

    Any help would be greatly appreciated,

    Chris
    Last edited by NBVC; 08-15-2011 at 04:10 PM.

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

    Re: Using row function in indirect

    How do you get: #INDIRECT("'"&A10&"'!"&"A1") to hyperlink?

    I would try: =HYPERLINK("#'"&A10&"'!"&"A1",A10)

    copied down
    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
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Hi NBVC,

    Thanks very much for the reply, I tried your suggestion but unfortunately it doesn't work. When I paste =HYPERLINK("#'"&A10&"'!"&"A1",A10) into cell A10, it creates a circular reference. When I paste it into the 'link to' box, it also gives an error. I'm not exactly sure if I'm using it correctly.

    What I was looking to do was to go to insert hyperlink and in the 'link to' box, I would put in #INDIRECT("'"&A10&"'!"&"A1"). This would work except when I copy and paste this into other rows, the A10 stays the same, but I want it to change to A11 or A12 and etc.

    So I tried keeping the 'A' the same and using the row function to get the 10 or 11 but the formula doesn't seem to work. This is what I would like help with as I probably haven't written it correctly:
    #INDIRECT("'"&"A"&ROW()&"'!"&"A1")

    Sorry if this is confusing, I'm not very good at Excel.

    Chris

  4. #4
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Actually, don't worry, I found out a solution. I tried using another indirect function inside the original one, with the "A" and the row function inside that. Here it is:
    #INDIRECT("'"&INDIRECT("A"&ROW())&"'!"&"A1")
    Now it links to whatever its cell name is and it changes when I copy and paste it in other rows.

    Chris

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

    Re: Using row function in indirect

    That's interesting. I have never done that before... i.e using a formula in the Insert|Hyperlink feature....

    My suggestion was putting my formula cells in adjacent columns.

    Can you explain exactly how your are accomplishing the task? Are you putting the link in adjacent cells? If so, when I copy down, the actual link remains to the first one I added the link to... i.e. it always links to same sheet.

  6. #6
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Hi NBVC,

    Yes I kinda guessed your formula was for adjacent cells but the one I used is placed in the hyperlink box of the cell I am referring to. For example, if cell A1 has "ABC" in it, I would place this formula:
    #INDIRECT("'"&INDIRECT("A"&ROW())&"'!"&"A1")
    into the hyperlink box of A1 and when I click on it, it will take me to cell A1 of sheet "ABC"
    When I copy and paste it downwards, the sheet would change depending in what is in cell A2, A3 and etc.

    Hope this helped,

    Chris

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

    Re: Using row function in indirect

    How are you copy/pasting? If I copy down it links always to the sheet named in cell A1.

  8. #8
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Well I only know one way to copy and paste, you right click on the first cell, press copy, right click on a cell below it and press paste. I think, maybe, it's because I am using Excel 2011 for Mac. Today, I was playing around with Excel 2007 on Windows and I couldn't really see a hyperlink box where you can type a formula like the one I used. Perhaps you need to type a formula directly into the cell and not the hyperlink box but I don't know what you would type in. When I opened the spreadsheet I created with Excel 2011 in Excel 2007, the hyperlink formula still worked but I couldn't find a way to edit it as the hyperlink box was different.

    I've attached a sample spreadsheet showing basically what my formula does. Hope it clears some things up.

    Chris
    Attached Files Attached Files

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

    Re: Using row function in indirect

    I am not sure it has to do anything with the formula.

    If I go into any random cell in Sheet1, and then right-click and select Hyperlink.

    Click Place in this Document from the left Link to pane

    Then select say STU from the large white pane with the option tree and click OK. The cell now has a hyperlink to sheet STU, cell A1.

  10. #10
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Yes I know you could right click, press hyperlink and select a sheet from the option tree, but if you copy and pasted this in another row, it would still be referencing STU and not whatever is in the new cell. This is not what I wanted to happen. I believe that if you tried copying and pasting the cells I had already created, they would link to the new sheets.

    However, I don't know how to enter the hyperlink formula for more cells in Windows as it just gives you an option tree and not much more. On Office 2011 for Mac, there is a hyperlink box where you can type a formula. I used a formula containing the row function so no matter where the cell is located, it will look at a certain column (A in my example) and the row in which the cell is (can be 1,2,3,4 etc). Using the indirect function, Excel will look at whatever is inside that cell and create a link to a sheet with the same name.

    I know this isn't a perfect formula for every cell in a sheet, but it works for my needs.

    Chris
    Last edited by chrisexcel; 08-16-2011 at 08:24 AM.

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

    Re: Using row function in indirect

    Can you paste a .jpg of that hyperlink box out of curiousity?

  12. #12
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    Sure, here it is.
    Attached Images Attached Images

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

    Re: Using row function in indirect

    Thanks.

    I think it may be that "anchor" field that PC Excel doesn't have.... Maybe Excel 2010 has it, I don't have that version as of yet... so it may remain a mystery for now...

    but thanks for trying to clarify for me. Appreciated.

  14. #14
    Registered User
    Join Date
    06-29-2011
    Location
    Sydney
    MS-Off Ver
    Excel 2011
    Posts
    14

    Re: Using row function in indirect

    No problem at all, and thanks for answering my initial post.

    Chris

+ 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