+ Reply to Thread
Results 1 to 5 of 5

Shading areas off a countif

Hybrid View

exceljunky Shading areas off a countif 04-25-2009, 10:16 PM
NBVC Re: Shading areas off a... 04-25-2009, 10:42 PM
exceljunky Re: Shading areas off a... 04-25-2009, 11:42 PM
exceljunky Re: Shading areas off a... 04-26-2009, 02:54 AM
NBVC Re: Shading areas off a... 04-26-2009, 09:03 PM
  1. #1
    Registered User
    Join Date
    04-25-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Question Shading areas off a countif

    what i have done is made a grid 10x10 and in that grid are a combination of the letters a, b and c.

    im using a countif to count how many a's, b's and c's exist in the grid. The abc's represent seats in a cinema.

    Lets say there are 20 seats of type A. I want to start selling tickets for A but colourise seats sold automatically. How would i do this?

    eg

    in my spread sheet i will have a cell which says no of A seats available and in this case the answer is 20. When i enter 12 tickets sold in another column, i want 12 of the 20 seats to go red in the grid. it doesnt matter which seats are coloured so as long as the sold seats are indicated on my 10x10 grid.

    How would i do this? Can it be done?
    Last edited by exceljunky; 04-25-2009 at 10:17 PM. Reason: missed a couple of words

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Shading areas off a countif

    Here's one way.. this will highlight all "a's" starting at top left-most cell go to the top-right most and then continuing to next row until desired count is met.

    First, make sure you start at minimum, row 2...

    So say your matrix is in A2:J11... and your input letter "a" is in L1 and your desired count is in L2...then

    select A2:J11 and go to Format|Conditional Formatting and select Formula Is from 1st drop down and enter following formula:

    AND(A2=$L$1,COUNTIF($A2:A2,$L$1)+COUNTIF($A$1:$J1,$L$1)<=$L$2)
    Click Format and choose colour pattern.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    04-25-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Shading areas off a countif

    woah . . need 5 to see whats happening. Thanks a lot for this. will go and experiment

  4. #4
    Registered User
    Join Date
    04-25-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Shading areas off a countif

    no i couldnt get it to work. ive attached my sheet
    Attached Files Attached Files

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Shading areas off a countif

    You have 100 in L1, should be an "a", no? If you put an "a" in L1, it works as intended.

    You also added to the conditional formula a +$C$2?

    Formula in CF should be:

    =AND(A2=$L$1,COUNTIF($A2:A2,$L$1)+COUNTIF($A$1:$J1,$L$1)<=$L$2)
    Attached Files Attached Files
    Last edited by NBVC; 04-27-2009 at 07:49 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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