As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

Excel Question (Referencing Result of Cell?)

Sir CarcassSir Carcass I have been shown the end of my worldRound Rock, TXRegistered User regular
edited July 2008 in Help / Advice Forum
This may be an easy question. I looked around using Search but didn't see this. Is there a way in Excel 2003, formula or otherwise, to have a formula evaluate the result of another formula?

Specifically, I have one column (we'll say Column B) of cells with a formula referencing another column (Column A). This is a simplification of it: IF(A1>0, do stuff, ""), so if the cell in Column A is blank, it won't display anything. The problem is that column A has a formula referencing another spreadsheet using the same IF function, so while it may look blank (and is, as far as this is concerned), it's never actually blank as far as Excel cares (the formula is always there, so it's technically not blank).

Is there a way to do something like: IF(RESULT(A1)>0, do stuff, "")? I tried Value(), but that does nothing. As it is now, the column is showing #VALUE!, where if I delete the formula in Column A, it's blank as I want it. Is what I'm looking for possible?

Sir Carcass on

Posts

  • Options
    DaenrisDaenris Registered User regular
    edited June 2008
    Something like
    IF(AND(A1>0,A1<>""),do stuff,"") works for me in the situation you describe.

    Daenris on
  • Options
    whuppinswhuppins Registered User regular
    edited June 2008
    When I have to write something like this, I always construct it like so:

    =IF(A1="","",do stuff)

    In other words, looking for a value of "" will satisfy both the 'pseudo-blank' and 'really blank' conditions. Look for that value, and run your code if the outcome is false. Looking for "" is much more foolproof than looking for >0.

    whuppins on
  • Options
    DaenrisDaenris Registered User regular
    edited June 2008
    Unless he also doesn't want to do anything if the value is less than 0 :)

    Daenris on
  • Options
    Sir CarcassSir Carcass I have been shown the end of my world Round Rock, TXRegistered User regular
    edited June 2008
    whuppins wrote: »
    When I have to write something like this, I always construct it like so:

    =IF(A1="","",do stuff)

    In other words, looking for a value of "" will satisfy both the 'pseudo-blank' and 'really blank' conditions. Look for that value, and run your code if the outcome is false. Looking for "" is much more foolproof than looking for >0.

    Awesome, that did it. Any idea why ="" evaluates the result of the function while >0 doesn't?

    Yeah, Column A is dates, so I don't care if it's less than zero, but I appreciate the suggestion.

    Still, is there a way to do what I was originally asking? It may not be necessary here, but there have been other times in the past where it would have been helpful.

    Sir Carcass on
  • Options
    DaenrisDaenris Registered User regular
    edited June 2008
    >0 IS evaluating the result of the function. However the result of the function is "", not actually a blank cell. The solution I gave will give you the result you're looking for, while ignoring cells that have "" in them.

    Daenris on
  • Options
    whuppinswhuppins Registered User regular
    edited June 2008
    OK, I have to confess, I still don't have a clear grasp on the problem you're trying to solve (or, rather, the problems you've tried to solve in the past). So instead of a specific answer, I'll guide you to the following functions that may help you if you read up on them in the Excel documentation:

    CELL()
    ISBLANK()
    TEXT()
    ISNONTEXT()
    ISREF()
    ISTEXT()
    Range().Value property (VBA)

    If you want to share some specific examples of other problems you've had, I could maybe give more specific advice. As it is I just can't wrap my head around the underlying problem here. All I can see is that you've hard-coded a "" value into a cell under certain conditions, so you would want to look for that value when referencing it. I can't think of any other situations where simply referencing a cell wouldn't work. I'm sure there are other cases, but I'm not coming up with any off the top of my head and without that context, it's hard to tell exactly what you want Excel to do.

    whuppins on
  • Options
    Sir CarcassSir Carcass I have been shown the end of my world Round Rock, TXRegistered User regular
    edited July 2008
    whuppins wrote: »
    If you want to share some specific examples of other problems you've had, I could maybe give more specific advice. As it is I just can't wrap my head around the underlying problem here. All I can see is that you've hard-coded a "" value into a cell under certain conditions, so you would want to look for that value when referencing it. I can't think of any other situations where simply referencing a cell wouldn't work. I'm sure there are other cases, but I'm not coming up with any off the top of my head and without that context, it's hard to tell exactly what you want Excel to do.

    To be honest, I can't remember off the top of my head specific examples. I just remember thinking, "If this were a pointer, this would be much easier."

    The more I think about it, though, the more I may be confusing myself. I think Excel usually does reference the result of a function. I think I was just going about this particular problem in the wrong way.

    I'll read up on those functions, though, just to expand my knowledge.

    Sir Carcass on
Sign In or Register to comment.