+ Reply to Thread
Results 1 to 13 of 13

Formula for finding value differences within a range Giving wrong answers

  1. #1
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Formula for finding value differences within a range Giving wrong answers

    Hi,

    I have formula in cell I5. This formula in cell I5 has following functions to do:
    If the value comes in this Range < 4 And >-4 Then it does not write this value and leaves the cell blank.
    If the value comes in this Range ≥4 and ≤-4 Then it writes this value in the cell.

    But the answers are coming wrong in cell I5 and onward. Like in cell I5, answer is -2 which is in this range < 4 And >-4 so it should leave this cell blank.

    (For more clarification i have attached the excel file)
    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 2406
    Posts
    44,662

    Re: Formula for finding value differences within a range Giving wrong answers

    Before I look at this, would you care to comment on your previous thread (no response from you) and ALSO explain HOW this differs from your previous request (duplicate threads are not permitted).
    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

  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 2406
    Posts
    44,662

    Re: Formula for finding value differences within a range Giving wrong answers

    Thanks, Please explain what you WANT the formula to do. It is hard to follow a non-working formula!! Also, your sample is too big. Manually checking >1000 rows of data is impossible. Upload a sample with 10-20 rows with expected answers. See yellow banner (top) about sample sheets.

  4. #4
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Hi Sir Glenn Kennedy,

    My previous post was about to take range from the cells value and you solved it. It took sequence from the cells as i wanted.
    But when i inserted more values in column G, then this formula was not giving corrected answers. I really don't know where the mistake is?

    Can you pleas sir look at this find why this problem is happening.

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

    Re: Formula for finding value differences within a range Giving wrong answers

    See Post 4.

  6. #6
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Hi Sir Glenn Kennedy,

    Please see this attached file. I have tried to make it short to 20th Rows.

    As you can see error is occurring in I6 and I7 cell values. Both are in this range < 4 And >-4 so formula should leave these cells blank.
    Attached Files Attached Files

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

    Re: Formula for finding value differences within a range Giving wrong answers

    Can you explain what the formula is MEANT to do?

  8. #8
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Hi Sir Glenn Kennedy,

    Please let me Explain

    I have values in column G from cell G5 onward. In cell H5, I have value to compare with values of column G.

    • Expected Results in Column I


    In cell I5
    I want that value of H5 should be subtracted from G6 value i.e. =G6-H5. And if the difference is < 4 And >-4 (4 comes from cell value of G1), Then it should not write this difference value in cell I5. It should move to check next cell difference i.e. =G7-H5. Again if the value lies in this range < 4 And >-4 then it should not write this value in cell I5 and move on to the next difference of =G8-H5. And when the difference comes ≥4 and ≤-4, then it should write this current difference value in cell I5.

    In cell I6
    I want that value of H6 should be subtracted from G7 value i.e. =G7-H6. And if the difference is < 4 And >-4, Then it should not write this difference value in cell I6. It should move to check next cell difference i.e. =G8-H6. Again if the value lies in this range < 4 And >-4 then it should not write this value in cell I6 and move on to the next difference of =G9-H6. And when the difference comes ≥4 and ≤-4, then it should write this current difference value in cell I6.
    And same for onward cells in column I.


    (Value of 4 comes from cell G1. And value -4 is just additive inverse of 4 in G1)

    Then one of the member (protonLeah) at this excel forum gave me this formula

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then i asked you about modification that this formula should take range from cells. Now when i insert more values in column G then answers are not as i wanted. Please check where the mistake is.
    Last edited by rexcel548562; 07-12-2022 at 02:45 AM.

  9. #9
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Hi Sir Glenn Kennedy,

    I have made it more clear. Please see this new attached file. From cell J5 onward i have inserted formula made by PronLeah. And from I5 onward i have inserted formula after making modification of taking series for selection in column G from cells K and L.

    There is a difference between their results. I have highlighted them in Red color.
    Attached Files Attached Files

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

    Re: Formula for finding value differences within a range Giving wrong answers

    Put about 6 rows of data in there. Add the expected results, for all 6 calculated manually. I think I follow, but don't want to spend more time doing the wrong thing. Does the existing formula (proton leah) DEFINITELY give the correct result in ALL circumstances??

  11. #11
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Yes Sir,

    Formula by protonLeah gives exact results that i wanted in all circumstances.

    But after modification it is making wrong answers. Please see attached file in post#9 for more clarification
    Last edited by rexcel548562; 07-12-2022 at 03:27 AM.

  12. #12
    Forum Contributor
    Join Date
    07-10-2022
    Location
    USA
    MS-Off Ver
    2021
    Posts
    190

    Re: Formula for finding value differences within a range Giving wrong answers

    Hi Sir Glenn Kennedy,

    Your modified formula worked and it gave me exactly the same results as i wanted in all circumstances.

    I am really thankful to you. Problem solved and i have marked this thread as solved.

  13. #13
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2505
    Posts
    13,757

    Re: Formula for finding value differences within a range Giving wrong answers

    And do not PM members (including Moderators) for help with Excel questions.
    Administrative Note:

    You PMed me last night 10:31 PM CDST.

    Unfortunately, it has come to our attention you have violated Rule #8 of our Forum RULES:

    Don't private message, visitor message or email Excel (or Access, Word, etc.) questions to moderators or other members.

    All questions and answers will benefit other posters like yourself when discussed in public threads. The point of having a public forum is to share solutions to common (and sometimes uncommon) problems with all members.

    Breaking this rule is considered harassment by most of our contributors and thus cannot be tolerated. Repeat offense could lead to a permanent ban, so do take this caution to heart.

    Post your question in a public thread and our many contributors will come to your assistance, especially if the title is accurate (see Rule #1) and you include a sample desensitized workbook that makes it easy for others to try and help.
    Dave

+ 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] Interquartile range function giving wrong results
    By gko_87 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-04-2017, 12:21 PM
  2. [SOLVED] Range.Find - Giving back the wrong result
    By KelFofo in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-13-2016, 07:11 PM
  3. excel giving wrong answers
    By rizwan32 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-25-2013, 04:01 PM
  4. Replies: 5
    Last Post: 09-08-2009, 08:37 AM
  5. [SOLVED] Wrong formula answers
    By Kevin G in forum Excel General
    Replies: 2
    Last Post: 06-19-2006, 03:10 AM
  6. Recalculating Formula - Getting the wrong answers
    By skherzog in forum Excel General
    Replies: 2
    Last Post: 06-29-2005, 08:05 AM
  7. Please HELP!! Giving wrong answers!
    By lloydowens in forum Excel General
    Replies: 1
    Last Post: 03-16-2005, 10:34 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