+ Reply to Thread
Results 1 to 10 of 10

LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

  1. #1
    Registered User
    Join Date
    09-29-2012
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    43

    LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Need one of you excel gurus to help spot what's going on here. I have a named range that has a value for each of 10 periods. I'm using a Large/Countif formula to identify from other IF statement criteria, which period in named range would be captured for the table I have the formula in. My forumla works perfectly for just about every value I put in the reference cell (G5), but for some reason any number below 28,200 gives me the same number for year 3, year 4, and year 5. Any value above 28200, gives the correct increment in accordance to the named range. I have nothing in my formula that should put constraints in to do this. I'm not seeing what could be causing this problem. Any help you can give would be much appreciated.

    =IF(C12>=$L$2,$L$2,LARGE(PositionC,COUNTIF(PositionC,">"&C12)))

    File

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    To best describe or illustrate your problem you would be better off attaching a dummy workbook. The workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    To attach a file to your post,
    click advanced (next to quick post),
    scroll down until you see "manage file",
    click that and select "add files" (top right corner).
    click "select files" find your file, click "open" click "upload" click 'done" bottom right. click "submit reply"

    Once the upload is completed the file name will appear below the input boxes in this window.
    You can then close the window to return to the new post screen.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    09-29-2012
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    43

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Thanks Ford. I gave a Dropbox file link at the bottom of my OP ("File"). Will that not suffice?

  4. #4
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,823

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    I believe it has to do with something about rounding for year 3 (cell e2). If you round that value to 2 digits, then all values seem correct. Or, if you multiply years 1 - 10 by 10, it all seems to work as well. I don't have the exact answer, but maybe this will point you (or someone) to something?

  5. #5
    Registered User
    Join Date
    09-29-2012
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    43

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Still giving me trouble. Will work for higher numbers, depending on how many digits I go out, but lower numbers will have the same issue. Possibly on the right track, but missing something.
    Last edited by RenoMartinez; 05-16-2019 at 12:15 AM.

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

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Thanks Ford. I gave a Dropbox file link at the bottom of my OP ("File"). Will that not suffice?
    You may get faster help if you upload directly to the site.
    That said I can not say why the array formula gave incorrect values in F12:G12. What I can offer is an AGGREGATE based formula that seems to work correctly:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that the formula should be pasted into D12 and dragged across.
    Note that this is a regular formula and does not require CSE activation.
    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.

  7. #7
    Registered User
    Join Date
    09-29-2012
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    43

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Quote Originally Posted by JeteMc View Post
    You may get faster help if you upload directly to the site.
    That said I can not say why the array formula gave incorrect values in F12:G12. What I can offer is an AGGREGATE based formula that seems to work correctly:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that the formula should be pasted into D12 and dragged across.
    Note that this is a regular formula and does not require CSE activation.
    Let us know if you have any questions.
    I'm really impressed with your formula, as I've never used 'Aggregate' function before. It works perfectly, but I'm confused as to how it's configured. You chose 15, which is for the Small functionality, which surpised me. I would have assumed the Large function would have been selected. Also, your PositionC/(PositionC>C12) gives me a calculation of .97322217. How does that factor into the overall calculation.

    Also, please don't miscontrue this as a challenge to your formula. You obviously have excellent excel skills, which based on what you've provided, are better than mine. I just love the Aggregate formula you've shown me and would like use it more often going forward. Any help you can give would be appreciated. Thank you for your post

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

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Using the Evaluate Formula feature see that PositionC is an array of values and that PositionC>C12 will evaluate to an array of trues and falses. When true is the denominator it is equivalent to dividing by 1 and when false is the denominator it is equivalent to dividing by zero (hence the second argument is 6 which ignores the DIV/0 error). All the values that are larger than C12 will be available to the SMALL (15) function, and we only want the one that is next value after the one displayed in C12 (hence SMALL and 1 as the [K]). Hopefully I have explained well enough, let us know if not or if you have any questions.
    If your query we has been resolved/addressed satisfactorily please mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,410

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Quote Originally Posted by RenoMartinez View Post
    Thanks Ford. I gave a Dropbox file link at the bottom of my OP ("File"). Will that not suffice?
    We have a perfectly good attachment system here so that members do not have to follow external links.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  10. #10
    Registered User
    Join Date
    09-29-2012
    Location
    Houston, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    43

    Re: LARGE With CountIf Function Giving Same Kth Value On Some Numbers.

    Quote Originally Posted by JeteMc View Post
    Using the Evaluate Formula feature see that PositionC is an array of values and that PositionC>C12 will evaluate to an array of trues and falses. When true is the denominator it is equivalent to dividing by 1 and when false is the denominator it is equivalent to dividing by zero (hence the second argument is 6 which ignores the DIV/0 error). All the values that are larger than C12 will be available to the SMALL (15) function, and we only want the one that is next value after the one displayed in C12 (hence SMALL and 1 as the [K]). Hopefully I have explained well enough, let us know if not or if you have any questions.
    If your query we has been resolved/addressed satisfactorily please mark the thread as 'Solved' using the thread tools menu above your first post. I hope that you have a blessed day.
    Thank you for the explanation

+ 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. LARGE function not giving desired results
    By jobdillon in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 11-07-2016, 12:42 PM
  2. [SOLVED] COUNTIF function giving Type Mismatch error
    By Utzja1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2016, 07:34 AM
  3. INDEX/MATCH with =LARGE is giving duplicates
    By keith740 in forum Excel General
    Replies: 6
    Last Post: 10-07-2015, 03:35 AM
  4. [SOLVED] SUMIF Function for a large group of file numbers
    By kas05j in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2015, 05:12 AM
  5. Counta and countif and large function problem
    By Seretha in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-15-2012, 05:03 AM
  6. =Large Function - Multiple numbers
    By afriedman in forum Excel General
    Replies: 7
    Last Post: 03-22-2012, 04:06 PM
  7. Replies: 3
    Last Post: 12-20-2011, 07:13 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