+ Reply to Thread
Results 1 to 14 of 14

Stop countif with circular reference

  1. #1
    Registered User
    Join Date
    07-27-2016
    Location
    manchester
    MS-Off Ver
    Office 365
    Posts
    12

    Stop countif with circular reference

    Hi,

    My problem is easier to understand with the excel open. What I want is to enter a certain number of stores to be opened in a given year and once that number has been reached to pass to the openings of the second year, that until the number of stores of the last year have been reached and then the result is blank. Unfortunately, since the the result is dependent of the COUNTIF() which itself is dependent of the result the formulas gives a circular reference. Is there any way to give the number of stores of the first year and then once that number has been reached to pass to the second part of the formula?

    Thank you in advance for your help
    Attached Files Attached Files

  2. #2
    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,869

    Re: Stop countif with ciruclar reference

    What exactly is the purpose of the vertical range?
    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.

  3. #3
    Registered User
    Join Date
    07-27-2016
    Location
    manchester
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Stop countif with ciruclar reference

    Thx for the quick reply

    The vertical range is the number of stores so normally I should have 2 "2018", 1 "2019", 3 "2020", 2 "2021", 1 "2022"

  4. #4
    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,869

    Re: Stop countif with ciruclar reference

    I don't understand. Every cell in that vertical array has the same formula. What do you mean when you say that the range is the number of stores? Can you please let us know what your expected outcomes are and where they should appear?

  5. #5
    Registered User
    Join Date
    07-27-2016
    Location
    manchester
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Stop countif with circular reference

    Yes what I am trying to do with the formula is that once the number of stores has reached the number in row 8 the result should be the following year and once that number has been reached the one after that and on and on. The expected outcome should be:

    2018
    2018
    2019
    2020
    2020
    2020
    2021
    2021
    2022
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK
    BLANK

    Thx for your patience

  6. #6
    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,869

    Re: Stop countif with circular reference

    OK. In H15, type this:

    =H7

    In H16 this, copied down:

    =IFERROR(IF(COUNTIF($H$15:H15,INDEX($H$7:$L$7,,MATCH(H15,$H$7:$L$7,0))) < INDEX($H$8:$L$8,,MATCH(H15,$H$7:$L$7,0)),H15,H15+1),"")

    You do not need the data in the range H10 to L11.

    Note the double comma is NOT a typo!
    Last edited by AliGW; 07-27-2016 at 11:57 AM.

  7. #7
    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,869

    Re: Stop countif with circular reference

    A sligtly better version:

    =IFERROR(HLOOKUP((IF(COUNTIF($B$15:B15,INDEX($B$7:$F$7,,MATCH(B15,$B$7:$F$7,0))) < INDEX($B$8:$F$8,,MATCH(B15,$B$7:$F$7,0)),B15,B15+1)),$B$7:$F$7,1,0),"")

  8. #8
    Registered User
    Join Date
    07-27-2016
    Location
    manchester
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Stop countif with circular reference

    Amazing it works! Thank you very much!

  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,869

    Re: Stop countif with circular reference

    You're welcome!

  10. #10
    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,869

    Re: Stop countif with circular reference

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED and consider clicking on the reputation button to thank anyone who helped you . Thanks.

  11. #11
    Registered User
    Join Date
    07-27-2016
    Location
    manchester
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Stop countif with circular reference

    One last question, if I put 0 in one of the cells row 8 I still have one entry of that year. Would it be possible to give the following year as a result instead?

    Thx

  12. #12
    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,869

    Re: Stop countif with circular reference

    Working on it - nearly there!

  13. #13
    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,869

    Re: Stop countif with circular reference

    Sorry - I can't make it work for the situation where there might be more than one consecutive zero.

  14. #14
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Stop countif with circular reference

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

+ 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. How to stop the help popup window with circular references?
    By ericsastud in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-04-2019, 03:48 AM
  2. Replies: 2
    Last Post: 02-23-2014, 06:06 PM
  3. [SOLVED] how to stop circular reference warning?
    By vengatvj in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-21-2013, 07:53 PM
  4. [SOLVED] Stop circular reference warning
    By shiftyspina in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-21-2013, 08:57 AM
  5. Circular Reference when formulas reference end of row formula!
    By Spellbound in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-29-2009, 08:26 AM
  6. Replies: 1
    Last Post: 08-21-2007, 07:22 PM
  7. [SOLVED] Stop Circular Reference Help Notices
    By Brig Siton in forum Excel General
    Replies: 2
    Last Post: 05-19-2006, 01:10 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