Viewing 22 posts - 1 through 22 (of 22 total)
  • Excel – this one might even be difficult
  • scaredypants
    Full Member

    or possibly trivial 😳

    imagine a spreadsheet with a list of STW usernames and then a series of columns showing characteristics (say a hitter status column, ranging from “big hitter” to “normal person” in one column but there are maybe a thousand other possible descriptions of hitter status between these two)

    Is there a way of sorting rows by hitter status but also then either colouring every different description differently from adjoining groups or else separating each group by an empty line ?

    I wondered about conditional formatting but there are too many descriptors to type in manually

    Thanking Yow

    lerk
    Free Member

    You’d have to use a lookup field or assign a hitter score…
    But once you’ve done that, it would be easy

    bikebouy
    Free Member

    ^that

    tjp1980
    Free Member

    First the sorting issue. Assume you want the order to be something like bad to good rather than just grouping them together?You familier with vlookup? On a separate worksheet (rename the worksheet to lookup)list all your possible statuses in order in one Column and in the next column to the right give each status a number (1, 2,3 etc). Then do a vlookup against each individuals status to return the number on the lookup worksheet. This will let you sort the statuses in order then. What version of Excel are you using for the formatting? Is it a one off job you are doing or something you will have to replicate time and time again?

    tjp1980
    Free Member

    Beaten to it…

    thepurist
    Full Member

    If you just want to alternate colour for each group it’s not difficult, you just need a formula to toggle between 1 and 0 each time the hitter status changes then format based on that.

    scaredypants
    Full Member

    I do know how to do lookup, and sorting by status would be trivial anyway just by using sort, wouldn’t it ?

    what I want is as below, can lookups do this ? :
    (actually, even if they could, populating the lookup with thousands of options would take ages wouldn’t it?)

    bighitter
    bighitter
    bighitter
    bighitter
    bighitter
    (then either a gap or else a different colour for all the next ones)
    troll
    troll
    troll
    troll
    troll
    troll
    troll
    troll
    troll
    troll
    (then either a gap or else a different colour for all the next ones)
    hardman
    hardman
    hardman
    hardman
    (then either a gap or else a different colour for all the next ones)
    etc

    scaredypants
    Full Member

    you just need a formula to toggle between 1 and 0 each time the hitter status changes

    <sits up>

    tinribz
    Free Member

    Why would you want to colour them? Use an if statement to assign a number to each unique type by adding 1 if not equal to the row above. Then do some countifs on the numbers for stats.

    tjp1980
    Free Member

    Sorting would be trivial assuming you didn’t mind that you might have it arranged like awesome, awful, brilliant, crappie etc. To get in an order that makes sense like awful, crappie, brilliant, awesome you need to create a sort key.

    thisisnotaspoon
    Free Member

    You could with a macro, something like

    Count the entries

    Work down the rows (count up 1 each time) untill 2 arent the same, Insert a row

    Continue untill count = number of entries.

    Havent got excel infront of me and not good enought to write VBA freehand!

    scaredypants
    Full Member

    Why would you want to colour them?

    for easy visualisation for those who don’t really know what the thing actually means but want to spout crap about how important they are

    Use an if statement to assign a number to each unique type by adding 1 if not equal to the row above

    <semi> 😳

    tjp1980
    Free Member

    Assuming your statuses are in column B and the data starts on row 2, put this formula in cell c2 and type a 1 into c1. =if(b2=b1,c1, if(C1=0,1,0)). Not got access to excel right now to check but think this will work. Then just conditional format based in this value.

    thepurist
    Full Member

    If hitter status is in b then a2 = if(b2=b1,a1,1-a1) should do it, but I’m far from a pic and my brain is being killed by flu so don’t take it as gospel

    tjp1980
    Free Member

    Drag that down over all rows of data.

    scaredypants
    Full Member

    sort order is unimportant (though I’ll learn WTF sort keys are at some point)

    counts probably do matter but I’m happy with that I think

    (I learned MID and IF(ISERROR … today – go me !!)

    scaredypants
    Full Member

    Ah, I think you people are dragging me there !
    There’s not a way to insert a blank row using commands, is there ?
    (though different/alternating colours might actually be better, thinking about it)

    tjp1980
    Free Member

    You would need a macro to insert a blank row. Not really something to type into a phone while away from excel!

    thepurist
    Full Member

    One way to get a gap would be to set column a quite narrow but format it to wrap text, then in a2 = if(b2=b1,””,”spaces”) – that needs to be enough spaces in the second part to force a line wrap.

    scaredypants
    Full Member

    Thanks all

    just found this which seems like it’ll do me too
    (thinking I’ll do the IFnumbery bit first, colour with conditional formatting and then insert the blanks – that’ll go, right ?

    tjp1980
    Free Member

    Your welcome. That looks like it will work no problem. Just be aware that if the macro falls over for any reason before it has run all the way through there is no error handling built into the code. This means that some of the things it has turned off (warnings) won’t be turned back on again. Not a particularly big deal (close and reopen excel) but can be really confusing if you don’t realise what’s happened.

    leffeboy
    Full Member

    If it’s just to let you look at the groups then you could just sort on hitter status and then subtotal on the bighitter status (on the data tab) to get expandable groups for each. The subtotal itself is of course meaningless unless you count the number of people in each group of course rather than add up the numbers

Viewing 22 posts - 1 through 22 (of 22 total)

The topic ‘Excel – this one might even be difficult’ is closed to new replies.