+ Reply to Thread
Results 1 to 6 of 6

Formula gives out wrong result, Help Please

  1. #1
    Registered User
    Join Date
    10-27-2014
    Location
    Los Angeles
    MS-Off Ver
    2013 Office Pro
    Posts
    4

    Formula gives out wrong result, Help Please

    This is my first time writing out formulas for excel and I'm only drawing on basic knowledge and some knowledge from computer programming classes in college to write these formulas (5+ years ago). I don't know excel terms or how some stuff works (dont even know what VBA means or is), so please understand I am a complete newbie at this. I may use the wrong terminology or word this incorrectly, so please be patient with me. Please help me figure out whats causing my formula to give out the wrong data. Thank you in advance

    So what I'm trying to do is M16 is an array to comb through the data and find the cells that passes all the criterias/rules(if and or functions), then show the min amongst the cells within that array. If no cells pass the criterias/rules, I want it to show 0.

    Problem: **Please check my sheet for reference** Based on my formula, all the imported data doesn't have an entry/cell that meets the criteria of the formula, yet it still gives out a number (D11 "560,000"). Row 11 passes most of the formula but doesn't satisfy the H criterias/rules (H11 "2.00 (2 0 0 0)") yet manages to still be displayed. Why is it showing D11? Did I use the quotation marks incorrectly? How do I have it show 0 since no cells satisfy my formula? Any help would be greatly appreciated!

    Here is a copy:
    {=MIN(IF((($B:$B="C/C")*($G:$G=2)*OR($H:$H="3.00 (3 0 0 0)",$H:$H="3.00 (2 1 0 0)",$H:$H="3.00 (1 2 0 0)",$H:$H="3.00 (0 3 0 0)")*IF(DATE(YEAR($I:$I),MONTH($I:$I)+6,DAY($I:$I))>TODAY(),TRUE,0)),$D:$D))}
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Formula gives out wrong result, Help Please

    Hi,

    Try below formula in M16:

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


    Just for suggestion, never used full column or row ref. in formulas. If you are not sure about the last row of you data is going to be, you can always used dynamic named range in the formula. This formula is slowing your spreadsheet. If the formula is giving correct result than write back I will guide you how to define dynamic named range.

  3. #3
    Valued Forum Contributor
    Join Date
    01-19-2012
    Location
    Barrington, IL
    MS-Off Ver
    Excel 2007/2010
    Posts
    1,211

    Re: Formula gives out wrong result, Help Please

    {=MIN(IF((($B:$B="C/C")*($G:$G=2)*OR($H:$H="3.00 (3 0 0 0)",$H:$H="3.00 (2 1 0 0)",$H:$H="3.00 (1 2 0 0)",$H:$H="3.00 (0 3 0 0)")*IF(DATE(YEAR($I:$I),MONTH($I:$I)+6,DAY($I:$I))>TODAY(),TRUE,0)),$D:$D))}

    That's pretty impressive for someone new to Excel formulas. I agree with misrasomendra that whole-column or whole-row references can slow things down with some types of formulas, it also creates compatability issues if the sheet is opened in an older version of Excel (Excel 2003 and prior did not allow whole-row/column references)


    VBA is basically Visual Basic 6 with some added MS Office functionality. VBA stands for Visual Basic for Applications. Pressing Alt + F11 will open a Visual Basic compiler you can code with, it is used for a wide variety of things, such as macro driven automation, database querying, writing custom formulas (UDF = User Defined Formula), or event triggers (Execute on Save for example). Depending on which language you have played with in college this could be something for you to look into if you have a coding background, as VB might be easier to follow than Formulas.

    As a formula note,

    =DATE(YEAR(A1),MONTH(A1),DAY(A1)) > TODAY(), it isn't necessary to use the DATE function for this, generally you can simply use =A1>TODAY()
    Last edited by Speshul; 10-27-2014 at 09:30 AM.
    You should hit F5, because chances are I've edited this post at least 5 times.
    Example of Array Formulas
    Quote Originally Posted by Jacc View Post
    Sorry, your description makes no sense. I just made some formula that looks interesting cause I had nothing else to do.
    Click the * below on any post that helped you.

  4. #4
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Formula gives out wrong result, Help Please

    I think it can be further short down to as below:

    =MIN(IF(($B2:$B37="C/C")*($G2:$G37=2)*(($H2:$H37="3.00 (3 0 0 0)")+($H2:$H37="3.00 (2 1 0 0)")+($H2:$H37="3.00 (1 2 0 0)")+($H2:$H37="3.00 (0 3 0 0)"))*($I2:$I37>TODAY()),$D2:$D37))

    Confirm With Ctrl+Shift+Enter.

    @speshul. Thanks for pointing in right direction.

  5. #5
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Formula gives out wrong result, Help Please

    the DATE formula was probably used as OP wanted to add 6 months. so using misrasomendra's formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    some other considerations for your range as misrasomendra pointed out:
    3 ways:

    1. go to your data, click on a single cell or to be safe, the whole range (like A1:J47) & press CTRL + T to convert it to a Table. now anything added will be in part of the Table & part of your pivot

    2. use formula OFFSET, put it in your Named Range & rename the source data to this Named Range

    3. use formula INDEX & put it in your Named Range & rename the source data to this Named Range

    for 2 & 3, you can start a thread separately.

    another tip. we are merely guessing what you are trying to achieve. so instead of showing us your formula which didn't work, let us know what you are trying to do with the criteria. for eg.
    column b must be equals to "C/C"
    column G must be equals to 2
    etc

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  6. #6
    Registered User
    Join Date
    10-27-2014
    Location
    Los Angeles
    MS-Off Ver
    2013 Office Pro
    Posts
    4

    Re: Formula gives out wrong result, Help Please

    Thank you 3 for helping me out. I used the formula you guys suggested and it works perfectly! As misrasomendra and speshul suggested, I took out the whole column range since it was lagging up the whole system; I did a range from B2:B100 since I doubt data will exceed that amount.

    Thanks benishiryo for those suggestions. My incoming data varies in size so im not sure if offset and index would work? I'm not very familiar with those functions so I might not fully understand their potential.

    Besides all that, I got it to work and still working on these spreadsheets. Thank you so much for all the generous help.

+ 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] Code result wrong but formula correct result
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-11-2014, 12:26 PM
  2. [SOLVED] formula returns wrong result
    By zplugger in forum Excel General
    Replies: 3
    Last Post: 03-12-2014, 01:17 PM
  3. Wrong result with IF formula
    By rizmomin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-25-2012, 03:57 PM
  4. formula giving wrong result sometimes?
    By lnjr in forum Excel General
    Replies: 2
    Last Post: 08-13-2010, 09:20 AM
  5. FORMULA PRODUCES WRONG RESULT
    By Wildebeest222 in forum Excel General
    Replies: 2
    Last Post: 10-11-2005, 05:05 AM

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