+ Reply to Thread
Results 1 to 12 of 12

Pulling a cell location based on contents

  1. #1
    Registered User
    Join Date
    06-10-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    16

    Pulling a cell location based on contents

    Hello,

    I would like to pull the address of a cell based on its content. Currently I have values in fields C1:C3 that are 50,0,0. I would like a formula which can pull the location of "C1" based on the fact that it is the only cell in the array which does not equal 0. I have had no luck creating one myself. Any help would be appreciated!

    Thanks!

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Pulling a cell location based on contents

    ..........................................................
    Last edited by Pepe Le Mokko; 06-10-2015 at 12:45 PM.

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Pulling a cell location based on contents

    Here's one way, though I agree with Pepe

    ="C"&MATCH(SUM(C1:C3),C1:C3,0)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Pulling a cell location based on contents

    Could there be more than one cell that does not contain zero? If so, what result do you expect?

    Will there be any negative numbers?

    Do you really want the cell address or do you want the actual value of the cell?
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Registered User
    Join Date
    06-10-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    16

    Re: Pulling a cell location based on contents

    I do need it for another formula. Can you elaborate on how you would used the index formula? I attempted to but had no luck.

    Thanks!

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Pulling a cell location based on contents

    ....................................................................
    Last edited by Pepe Le Mokko; 06-10-2015 at 12:46 PM.

  7. #7
    Registered User
    Join Date
    06-10-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    16

    Re: Pulling a cell location based on contents

    Yes, it is possible that there is more than one cell that does not contain zero. If that were the case then I would just want it to reference the cell furthest down. For example if, A1=10, A2=20, A3=0 -- I would like the formula to pull A2. And no, there will not be any negative numbers.

    Thanks!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Pulling a cell location based on contents

    I'm guessing that you don't need the cell address. You should be able to use the cell value in your other formula.

    This will return the bottom-most value in the range that is >0:

    =LOOKUP(2,1/(A1:A3>0),A1:A3)

  9. #9
    Registered User
    Join Date
    06-10-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    16

    Re: Pulling a cell location based on contents

    I believe that I do because I will be offsetting the result of this search by -1, so if the formula returns C1 the end formula will be using B1

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Pulling a cell location based on contents

    How about telling us what your end goal is?

    Maybe this...

    =LOOKUP(2,1/(C1:C3>0),B1:B3)

    No address necessary!
    Last edited by Tony Valko; 06-10-2015 at 12:46 PM.

  11. #11
    Registered User
    Join Date
    06-10-2015
    Location
    Washington DC
    MS-Off Ver
    2013
    Posts
    16

    Re: Pulling a cell location based on contents

    Tony, that worked for what I am attempting to do. Thanks so much! Would you mind explaining the parts of the formula to me? I cannot follow the logic for why it works.

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Pulling a cell location based on contents

    Here is a link to an explanation I wrote that is very similar to your application.

    Basically, the only difference is the range from which the result is taken.

    https://www.excelforum.com/showthread.php?p=3398950

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Pulling a Specific Cell when Pulling a Tabel from Web Based Data
    By Zallen89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2013, 05:39 PM
  2. Save specific sheet to location based on contents of cell
    By KJL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2012, 08:08 AM
  3. Replies: 0
    Last Post: 04-06-2012, 05:07 PM
  4. Replies: 2
    Last Post: 02-27-2009, 02:01 PM
  5. Paste to location based on Cell contents
    By RMT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2006, 04:35 AM

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