+ Reply to Thread
Results 1 to 8 of 8

Help with If Statement populating several Cells

  1. #1
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Question Help with If Statement populating several Cells

    Column A lists how many links should be created... a number from 1 through 4.
    Columns B, C, D, and E correspond to those 4 photo links.

    How do I set up a formula such that, if...

    A2 = 1, then B2 will create a hyperlink
    A2 = 2, then B2, and C2 will create a hyperlink
    A2 = 3, then B2, C2, and D2 will create a hyperlink
    A2 = 4, then B2, C2, D2, and E2 will create a hyperlink

    I do know how to create a hyperlink in a cell, so I don't need help with that.
    In which cell would I put in the formula? F2?
    I was thinking that a vlookup would help, but it would populate B2, C2, D2, and E2 when populating those cells is conditional based on what A2 will show (either a 1, 2, 3, or 4).
    Last edited by JPWRana; 06-24-2013 at 09:14 PM. Reason: A1=1 Should have been A2=2

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Help with If Statement populating several Cells

    You can't use a formula in a cell to populate other cells.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Help with If Statement populating several Cells

    What about a macro then?
    In this example, it would be done 45 times, but with a twist. If its blank, then the other cells in B,C,D, and E columns would also stay blank.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Help with If Statement populating several Cells

    How about...

    B2=if(A1>=1,your-hyperlink-formula,"")
    C2=if(A1>=2,your-hyperlink-formula,"")
    D2=if(A1>=3,your-hyperlink-formula,"")
    etc
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Help with If Statement populating several Cells

    That solved it.

    Now I have a more real world scenario that I'm working on that adds unfortunately 1 more layer of complexity.

    A3 may also equal 1-4, BUT for the scenario that A2 has either a 1, 2, 3, or a 4, then the hyperlinks keep on adding up.

    Ex:
    A2 = 3, THEREFORE B2, C2, and D2 have hyperlinks called widget(1), widget(2), and widget(3). (That part was solved, thanks to FDibbins).
    A3 = 4, THEREFORE B3, C3, D3, and E3 should have hyperlinks widget(4), widget(5), widget(6), and widget(7).

    OR
    A2 = 1 & A3=2,
    THEREFORE B2 should have hyperlink widget(1)
    and B3, C3, and D3 should have hyperlinks widget(2), widget(3), and widget(4).

    The only way that this scenario would work, where A2 and A3 would keep on counting up the (#)'s is because Z2 = Z3 = widget

    IF Z2= Widget, and Z3= Fidget, and Z4= Midget, then post #4 works perfectly.

    Can the column B, C, D, and E formulas be modified for this scenario?

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Help with If Statement populating several Cells

    perhaps if you look into including indirect() in your hyperlink formula?

  7. #7
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Help with If Statement populating several Cells

    how so?

    I never fully understood what indirect does (I did do my research to find out what it does, but I don't get what it's supposed to do. That's why I didn't immediately respond to your post. I was researching what it is and its use).

  8. #8
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Help with If Statement populating several Cells

    FDbbins, how can I use hyperlinking and indirect for the examples I have on Post #5?

  9. #9
    Forum Contributor
    Join Date
    10-23-2004
    Location
    Los Angeles
    MS-Off Ver
    2010
    Posts
    253

    Re: Help with If Statement populating several Cells

    Never mind, I got the last part of the question answered here:

    http://www.excelforum.com/excel-form...hyperlink.html

+ 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