+ Reply to Thread
Results 1 to 17 of 17

Trouble combining two formulas and retaining both outputs.

  1. #1
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Exclamation Trouble combining two formulas and retaining both outputs.

    Hi all,
    I am struggling to combine two formulas which are essentially two halves of the same end result into one formula.
    In one cell, I can get the formula to return a value if an amount is required, and in the other cell, I can get the formula to return a comment "Not Enough" if there is no amount or not enough available.
    However, I cannot seem to combine both sets together to give me one formula.
    I have attached a sample file and highlighted the cells in yellow.
    M15 works as it should, O15 works as it should, but N15 is where I have tried to combine them and it's returning a value error.
    Can anyone help on this please?

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trouble combining two formulas and retaining both outputs.

    What do you want the formula to do - it won't, as it is clearly incorrect... What is the expected answer manually how do you calculate it?
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trouble combining two formulas and retaining both outputs.

    This looks odd:
    =IF(M11="","",SUM(M11-M11*2))

    Why not just:
    IF(M11="","",-M11)

    Does this work in N15???

    =IF(M15<>"",IF(L15=0,"not enough",M15),"")

  4. #4
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Thanks for your reply.
    The expected outcome should be that it sums the cell in column "M" first of all (I have done it so that it converts from a negative number to positive number as it should read as a positive, although there is probably a more straightforward way!).
    It should then look at the cell in column "H", and if less than column "I", return a value of 0, if more than column "I", add the cell in columns "I" and "L" together (on that row). If this is still less than the call in column "H", return the message "Not enough".

    Hopefully that makes sense!

    Thanks in advance.

  5. #5
    Forum Contributor
    Join Date
    10-30-2019
    Location
    Bistrita, Romania
    MS-Off Ver
    2019; 365
    Posts
    231

    Re: Trouble combining two formulas and retaining both outputs.

    The sum you are using for the formula in N15 is not OK because if, like in your case, L15 is zero, then the SUM would be between -M15 and "not enough".
    Plus, SUM(M15-M15*2) could actually be written without sum, just as -M15 because that's the result of M15-2*M15.

    Maybe something like this is close to what you need:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    To show your appreciation
    Click ★ Add reputation!

  6. #6
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Thanks for that. I have tried that, but it appears to come up with an error still?
    Thanks

  7. #7
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    For ease of explanation, the purpose of column N is to convert the negative number to a positive number in column M as it reads wrong (it is supposed to read as a positive number in the first place).
    If there is then a positive number in column N, the formula should then sum I & L (stock locations) and if the sum total is less than Column H (amount required) it should return the text Not enough.

  8. #8
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Trouble combining two formulas and retaining both outputs.

    Quote Originally Posted by Johnny247 View Post
    Thanks for that. I have tried that, but it appears to come up with an error still?
    Thanks
    Who are you talking to?

    see sheet
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Hi Glenn, thanks for your reply. Unfortunately, that does not work. The sheet repeats what is already in column.
    I have tried amending it to this: =IF(M15="","",-M15,IF(L15=0,"not enough",M15)) But still no joy.
    Column N is a bit (in poor English!) like a helper column for me to convert the negative value to a positive as it should be but my formulas seem to just make it a negative value all the time!
    I need it to show the value (not a negative), or in the event that it genuinely is a negative, then show "Not enough".
    I can get it to work to convert it from a negative using column N, and I can get it to show not enough using the formula in column O, but I can't get them to work together in the same formula
    Hopefully you will understand all that! :-)
    Kind Regards,

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: Trouble combining two formulas and retaining both outputs.

    If I understand correctly:
    Paste the following into cell N5 and copy down: =IF(I5="","",IF(AND(I5<J5,I5-K5<>0,L5=0),"not enough",IF(I5<J5,I5-K5,0)))
    If that is not correct then I suggest manually typing the values you would like to see into any cell in column N that is displaying an incorrect value.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  11. #11
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Thanks for that. It works on some, but not all of them unfortunately.
    I have attached the result for you to see, and the expected outcome is written in column O and highlighted in yellow.

    Many thanks in advance.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    10-30-2019
    Location
    Bistrita, Romania
    MS-Off Ver
    2019; 365
    Posts
    231

    Re: Trouble combining two formulas and retaining both outputs.

    For example in cell N10 you say it should read "Not Enough" but as the formula is put, it shouldn't. Because the formula says:
    =IF(I10="";"";IF(AND(I10<J10;I10-K10<>0;L10=0);"Not Enough";IF(I10<J10;I10-K10;0)))

    All the colored arguments must be true for it to show "Not Enough".
    Blue is true because I10 = 8400 and J10 = 91800.
    Green is true because I10 (8400) minus K10 (-54600) = 63000 and is <>0.
    Red is false, because L10 is not = 0, L10 is 9800.

    The same goes for N5, N6 and N15.

    But stock is not enough when K15<0, so why not just say that instead of AND(I10<J10;I10-K10<>0;L10=0)?

    If you change the formula the way I suggested above, it becomes:
    =IF(I5="";"";IF(K5<0;"Not Enough";IF(I5<J5;I5-K5;0)))

    And shows "Not Enough" near all your yellow marked cells.

    Or if you want to also use external stock as stock, you could say K5+L5<0 so the formula would become:
    =IF(I5="";"";IF(K5+L5<0;"Not Enough";IF(I5<J5;I5-K5;0)))

    See attached with the last formula.
    Attached Files Attached Files

  13. #13
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Hi Mrrrr.
    That is a very comprehensive explanation, thank you, and the final formula works as it is meant to. Many thanks for your help.

  14. #14
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    Good morning,
    apologies, after some additional testing this morning, there is still a condition that is not met, that I "think" may require an OR statement in it. I have added comments for the condition and highlighted it in yellow. Please see attached.
    Many thanks in advance.
    Attached Files Attached Files

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: Trouble combining two formulas and retaining both outputs.

    It seems to me that the formula already in column K is taking care of the difference between columns H and I.
    That being the case it seems that the formula in column N could just look at the difference between columns K and L using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.

  16. #16
    Forum Contributor
    Join Date
    12-18-2013
    Location
    Kings Lynn, England
    MS-Off Ver
    Excel 2019
    Posts
    234

    Re: Trouble combining two formulas and retaining both outputs.

    That seems to have fixed it.
    Thank you very much for the help!
    Kind Regards,

  17. #17
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: Trouble combining two formulas and retaining both outputs.

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. [SOLVED] Combining 2 formulas - having trouble - please assist!
    By kirrash in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-13-2020, 11:50 AM
  2. [SOLVED] Trouble combining two formulas into one
    By mr63249 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2013, 08:53 AM
  3. Replies: 1
    Last Post: 11-05-2012, 12:52 AM
  4. Combining multiple columns into one on a new spreadsheet while retaining the header
    By Shaman7445 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-05-2012, 02:44 PM
  5. Combining Linked Cells While Retaining Formatting
    By Underdogdj in forum Excel General
    Replies: 7
    Last Post: 06-27-2012, 03:29 PM
  6. Add line and retaining formulas
    By Gideon15 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2012, 09:55 PM
  7. [SOLVED] Having trouble combining 4 cells with formulas into one cell formu
    By jimtmcdaniels in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2005, 09:00 PM

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