+ Reply to Thread
Results 1 to 12 of 12

Substituting cells formula???

  1. #1
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Substituting cells formula???

    Greetings All,

    I have a formula question that I can't seem to find the answer for.

    I want a "total" cell to check two cells. If cell 1 has a number, display it.

    If cell 1 does not have a number, check cell 2 and display it.

    If either cell does not have a number, display a zero.

    Thanks in advance for your help...

    Cheers - OS

  2. #2
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111

    Re: Substituting cells formula???

    G'day and welcome to the forum,

    Try this and remember to change my references to suit your data layout.

    Cell 1=D10
    Cell 2=D12

    =IF(ISNUMBER(D10),D10,IF(ISNUMBER(D12),D12,0))

    Cheers

    RC
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

  3. #3
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula???

    Thanks for the reply...

    It works with the first cell, but does not work with the second cell.

    =IF(ISNUMBER(L8),L8,IF(ISNUMBER(N8),N8,0))

    I've learned a great deal reading through this forum. Glad I found it...

    Thanks again,

    OS

  4. #4
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Substituting cells formula???

    What do you mean "....does not work with the second cell"? If N8 has a number and L8 doesn't you want to show the number in N8, are you saying that doesn't work with your data?

    It works for me. I put ratcat's formula in O8, left L8 blank and then put 10 in N8, O8 shows 10, isn't that what you require?

  5. #5
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula???

    I thought I had it. I tried reversing the formula:

    =IF(ISNUMBER(N8),N8,IF(ISNUMBER(L8),L8,0))

    In this scenario it shows N8, but if the cell is empty it does not show L8

    =IF(ISNUMBER(L8),L8,IF(ISNUMBER(N8),N8,0))

    In this scenario it shows L8, but if the cell is empty it does not show N8

    Maybe I'm missing something here.

    Thanks again for the help... Oh, I'm using Excel 2007, just in case.

    OS
    Last edited by olisim; 04-25-2010 at 11:27 AM.

  6. #6
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula???

    Both cells L8 and N8 are simplistic formulas.

    Would that be causing the issue?

    Thanks,

    OS

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Substituting cells formula???

    What formulas do you have in those cells? Functions like MID, LEFT, RIGHT and others always return a text result (even if it looks like a number) so the ISNUMBER part of Ratcat's formula might not recognise a number as you might expect. You could probably alter L8 and N8 to return genuine numbers.......or try changing to

    =IF(ISNUMBER(L8+0),L8+0,IF(ISNUMBER(N8+0),N8+0,0))

  8. #8
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula???

    Tried that as well, and still won't show N8

    Here is what makes those cells populate:

    L8 is calculated with =SUM(H8)*K8

    N8 is calculated with =SUM(J8)*M8

    Both L8 and N8 are currency fields, if that makes a difference.

    I think I'm just missing the logic here, or I haven't had enough coffee.

    Thanks again...

    OS

  9. #9
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,699

    Re: Substituting cells formula???

    Can you give a concrete example where the formula doesn't work as you want - what's in L8, what's in N8 and what do you want the formula to return.....and what does it return?

  10. #10
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula???

    L8 and N8 are totals for a construction process. Let's say L8 is option 1 and N8 is option 2.

    If L8 has a number, that number needs to be shown in P8 (total for that option).

    If L8 does not have a number, I need the formula to check N8. If that has a number, it needs to be shown in P8.

    Right now, with the formula given, if L8 has a number, it is shown in P8

    If L8 does not have a number, but there is a number in N8, P8 still show 0

    Does this make sense?

    OS

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Substituting cells formula???

    i think the problem is the cell isn't empty the formula =SUM(H8)*K8 returns 0 if h8 and k8 are blank
    similarly =SUM(J8)*M8
    perhaps
    =IF(L8<>0,L8,IF(N8<>0,N8,0))
    you could just use =IF(L8<>0,L8,N8) as if L8 is<>0 you'd get L8 if its not you'd get N8 but if N8 was 0 you'd get the desired answer 0 anyway
    Last edited by martindwilson; 04-25-2010 at 12:11 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  12. #12
    Registered User
    Join Date
    04-24-2010
    Location
    Nor Cal
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Substituting cells formula??? - Solved!

    That did it...

    Thank you so much!!!

    =IF(L8<>0,L8,IF(N8<>0,N8,0))

    I'm still not understanding the logic, but at least I can continue the project.

    Thanks for making my Sunday!!!

    OS

+ 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