+ Reply to Thread
Results 1 to 14 of 14

Defining cell ranges in formulas according to cells with a certain value

  1. #1
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Exclamation Defining cell ranges in formulas according to cells with a certain value

    Hi all, I've been trying all morning to figure out a complex problem, and I was hoping the good people here would be able to help.

    So I have a spreadsheet with a list of companies, list of users within those companies, and the status of those users(Active/Inactive/Deleted). I'm trying to determine the company-level status based on how the overall status of all the users in the company.

    E.g.
    Please Login or Register  to view this content.
    In the above example, cells D1 to D4 would list "Active", since Active users form the bulk of the company. D4 to D6 would list "Inactive" for Company B.

    I've figured out the first half of what I need to do:
    Please Login or Register  to view this content.
    My problem is in getting Excel to automatically define the cell ranges according to the cells that contain "Company A", "Company B", etc. I have over 5,000 rows on the spreadsheet so having to manually change the cell ranges for each company would take forever.

    I will be extremely grateful if anyone could help, it would save me a TON of work!!

    Also posted on http://www.mrexcel.com/forum/excel-q...ain-value.html, and http://www.excelbanter.com/showthread.php?t=448789
    Last edited by Dranoeler; 05-20-2013 at 12:44 AM.

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Defining cell ranges in formulas according to cells with a certain value

    Just clarify us about the method based on how you are marking D1:D4 as Active and D5:D7 as Inactive?


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    Hi Sixthsense,

    That's where the formula is supposed to go. I'm trying to figure out the formula that would automate that for the entire spreadsheet, based on the different ranges according to the company names

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Defining cell ranges in formulas according to cells with a certain value

    We will offer you the formula, but we need to know the logic about how you are marking those entries as Active/Inactive?

  5. #5
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    It depends on the overall status of the users within the company. If Company A has 5 users (3 Active, 2 Inactive, 1 Deleted), then D1:D4 would return an "Active" value.

    Similarly, if Company B has 3 users (2 Inactive, 1 Deleted), then D5:D7 would return an "Inactive" value. The same reasoning extends to Companies with more "Deleted" users than Active or Inactive

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

    Re: Defining cell ranges in formulas according to cells with a certain value

    Hi and welcome to the forum

    Based on your sample, how about something like this?
    =IF(A2=A1,"",IF(COUNTIFS(A:A,A2,C:C,"Active")>=COUNTIFS(A:A,A2,C:C,"Inactive")+COUNTIFS(A:A,A2,C:C,"deleted"),"Active","Inactive"))

    If you want them all to show...
    =IF(COUNTIFS(A:A,A2,C:C,"Active")>=COUNTIFS(A:A,A2,C:C,"Inactive")+COUNTIFS(A:A,A2,C:C,"deleted"),"Active","Inactive")
    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

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Defining cell ranges in formulas according to cells with a certain value

    Please don't cross post your question without supplying the link

    Cross Posted @
    http://www.mrexcel.com/forum/excel-q...ain-value.html

  8. #8
    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,946

    Re: Defining cell ranges in formulas according to cells with a certain value

    Thanks Six

    I'm afraid 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).

  9. #9
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    Apologies, all. I wasn't aware of this.

    I've edited my posts in accordance of the rules, both on this forum and the other two

    Pardon my ignorance!

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

    Re: Defining cell ranges in formulas according to cells with a certain value

    Thanks for that

    Did you look at post #6?

  11. #11
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    Quote Originally Posted by FDibbins View Post
    Hi and welcome to the forum

    Based on your sample, how about something like this?
    =IF(A2=A1,"",IF(COUNTIFS(A:A,A2,C:C,"Active")>=COUNTIFS(A:A,A2,C:C,"Inactive")+COUNTIFS(A:A,A2,C:C,"deleted"),"Active","Inactive"))

    If you want them all to show...
    =IF(COUNTIFS(A:A,A2,C:C,"Active")>=COUNTIFS(A:A,A2,C:C,"Inactive")+COUNTIFS(A:A,A2,C:C,"deleted"),"Active","Inactive")
    Hi FDibbins,

    Thanks for the suggestion. The second formula appears to work, but only for companies with more "Active" users. It returns "Inactive" for everything else

    For example:
    Company C has 3 Inactive users, 1 Active, 1 Deleted --> Returned value "Inactive"
    Company D has 2 Deleted Users, 1 Active --> returned value "Inactive"

    Also, I've run into a problem when a company has just 2 users and each has a different status:
    Company E has 1 Deleted, 1 Active --> ???

    My apologies again on the cross-posts!

  12. #12
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    FDibbins,

    I should have been clearer on one point: I'm trying to make it where the overall company status is either Active/Inactive/Deleted, depending on the majority status of the user within the company

    EDIT
    MANY thanks - I've fixed the problem where "Inactive" was the only Else value by using this:

    Please Login or Register  to view this content.
    I'm still running into the roadblock where there are just 2 users within a company each with a different status, though. Is there something I can tack on to the above to make it return a "TIE" value in such cases?
    Last edited by Dranoeler; 05-20-2013 at 01:13 AM.

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

    Re: Defining cell ranges in formulas according to cells with a certain value

    what result do you want if there is a tie? which 1 of the 2 takes precedence?

  14. #14
    Registered User
    Join Date
    05-20-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Defining cell ranges in formulas according to cells with a certain value

    Neither should take precedence, it should ideally return a "TIE" value so I can filter those out

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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