+ Reply to Thread
Results 1 to 8 of 8

Need to return a value from a column when two values from are equal

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Need to return a value from a column when two values from are equal

    See example attached. I am wanting to return the value from column A where the value in row three equals the value in column B (see formula used in example). The problem I am running into using the formula is that the formula in the adjacent cell is blocking the entire value from being displayed even though it is returning a null value. I would like to have the entire value displayed when the formula is true without having to expand the columns. What would be the best way to accomplish this?


    Thanks
    Attached Files Attached Files
    Last edited by Textoph; 06-19-2012 at 10:50 AM.

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,382

    Re: Need to return a value from a column when two values from are equal

    The only situation that I'm aware of where Excel will display beyond the boundaries of a cell is:

    a) cell contains text string and b) the cell(s) to the right are completely empty.

    If you really don't want to expand the column, you're going to have to put the formula in B inside the =TEXT() function to convert the number to text and you are going to have to clear (completely) column C. If the formula in column C is important, then you'll have to decide if you want to expand column B, or if you can move the formula in C to D.

  3. #3
    Registered User
    Join Date
    06-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need to return a value from a column when two values from are equal

    Thanks Mr. Shorty but is there a way to do this using VBA in the background so the cells would be blank and would allow the value to extend past the cell boundary if the statement is true?

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,382

    Re: Need to return a value from a column when two values from are equal

    I'm sure there is. It's not the kind of programming I do, so I'm not real good at it. something like
    Please Login or Register  to view this content.
    where condition is a boolean that decides when you need this action, and i,j are index numbers to indicate which cell needs to be cleared. I'm assuming that you will have already wrapped the function inside the TEXT() function so it will spill out into the adjacent cell once it is cleared. If you want, you can put this inside of a change or calculate event procedure if you want the code to run automatically with the appropriate event. You may also need an Elseif to restore the formula in the cleared cell when you need that formula
    Please Login or Register  to view this content.
    where formulastring is a string variable/constant that stores the necessary formula

  5. #5
    Registered User
    Join Date
    06-13-2012
    Location
    chennai
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Need to return a value from a column when two values from are equal

    one data enter in a column then same data enter in same column and indimate already enter in excel macro. how to do vba code?

  6. #6
    Registered User
    Join Date
    06-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need to return a value from a column when two values from are equal

    Ok, I figured out how to do it without the formula and just VBA. See below. Now I would like to see if there is a way to simplify this so I don't have the write an Else If statement for every cell in the range I am working with. Any suggestions?



    Please Login or Register  to view this content.
    Last edited by Textoph; 06-20-2012 at 11:17 AM.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Need to return a value from a column when two values from are equal

    rsankar011,

    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.
    HTH
    Regards, Jeff

  8. #8
    Registered User
    Join Date
    06-13-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Need to return a value from a column when two values from are equal

    Bump.

    Still tying to figure out how to do this with ranges as opposed to each individual cell.


    Please Login or Register  to view this content.

+ 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