+ Reply to Thread
Results 1 to 17 of 17

Insert image with IF statement

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    804

    Insert image with IF statement

    Is it possibe to insert an image (such as Picture1 which is the name of an image created by Insert>Name>Define) using an IF statement as in:

    =IF(A1=B1,+Picture1,"")
    Last edited by BRISBANEBOB; 06-02-2009 at 08:01 PM.

  2. #2
    Forum Contributor
    Join Date
    04-01-2009
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2010
    Posts
    280

    Re: Insert image with IF statement

    You could add a picture link with a formula simular to what you are asking.

    I put together a sample file with the instructions.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    804

    Re: Insert image with IF statement

    That is brilliant!

    Thanks - much appreciated.

  4. #4
    Registered User
    Join Date
    04-19-2012
    Location
    Fonthill
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Insert image with IF statement

    Is it possible to detail this answer more.

    I am at this section
    3) Create a defined name with your formula (example : MyPic)
    4) Copy a cell
    5) Holding the Shift key select the Edit Menu
    6) Select Paste Picture Link
    7) Change the formula for the picture to =MyPic)

    please advise on step 3 define name with formula

  5. #5
    Registered User
    Join Date
    08-07-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Insert image with IF statement

    Quote Originally Posted by Chance2 View Post
    You could add a picture link with a formula simular to what you are asking.

    I put together a sample file with the instructions.
    very bad explanation. unclear.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,067

    Re: Insert image with IF statement

    @stienus,
    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    Ben Van Johnson

  7. #7
    Registered User
    Join Date
    01-08-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    1

    Question Re: Insert image with IF statement

    I find this same solution in a number of places but each time with a horrid explanation.

    Lets say I have two images that I want to toggle between via a formula:
    The images will be referred to as Logo A and Logo B

    Logo A is hovering over the cells A1:B2 --> This Range i have named LOGORangeA
    Logo B is hovering over the cells C1;D2 --> This Range I have named LOGORangeB

    Now the next step is to create a picture linked image
    (And for anyone who doesn't know how to do this: select the cells behind the images (one at a time) and paste "As a Picture" picture linked image)

    So I now have two picture linked images, one for each Logo. After which, I click on the Logo A and change the formula to =LOGORangeA and the same for Logo B, =LOGORangeB

    At this point I have the two original images, two named ranges LOGORangeA & LOGORangeB, and now the two corresponding picture linked images that are named LogoA and LogoB respectively

    What is the next step? The instruction line in the sample spreadsheet states, "Create a defined name with your formula (example : MyPic)"
    What the heck does this mean?

    I can create a named range called MyPic and go into the name editor and define a formula referring to the named ranges LOGORangeA and LOGORangeB as appears is what is done in the spreadsheet. But that does not work.

    Where I am is stuck is how to define a function to toggle between the two images.

    Thanks in advance

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,067

    Re: Insert image with IF statement

    Real_Professional,
    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

  9. #9
    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
    38,836

    Re: Insert image with IF statement

    See: Control the display of a picture using a formula / Insert image with IF statement


    Note also that the correct way to ask a related question is to start your own thread and, where appropriate, as in this case, provide a link to the original thread.

    FWIW: I think it would be appropriate to mark this thread as Solved and Close/lock it down ... Moderators?

    Regards, TMS
    Trevor Shuttleworth - Excel Aid

    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


  10. #10
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: Insert image with IF statement

    Thread mark as solved.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  11. #11
    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
    38,836

    Re: Insert image with IF statement

    @Arlette; thanks

  12. #12
    Registered User
    Join Date
    10-14-2013
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Insert image with IF statement

    Thanks Bro, you solved my problem.

  13. #13
    Registered User
    Join Date
    10-14-2013
    Location
    Lahore, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Insert image with IF statement

    A bundle of Thanks, you did a great job.

  14. #14
    Registered User
    Join Date
    10-13-2012
    Location
    Grimsby, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Insert image with IF statement

    Hi chance2 do you still have your solution as it seems to be corrupted when I try to download it.

    Many thanks
    Paul

  15. #15
    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
    38,836

    Re: Insert image with IF statement

    The thread is 8 years old and chance2 hasn't been on the forum since September 2016.

    That said, the file downloads OK for me.

  16. #16
    Registered User
    Join Date
    10-13-2012
    Location
    Grimsby, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Insert image with IF statement

    Thanks TMS,

    I have it now I changed the file extension to .xls from .xlsx and it will now open and it works :-D, it had been saying missing file or corrupted.

  17. #17
    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
    38,836

    Re: Insert image with IF statement

    You're welcome.

+ 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