Excel - this one mi...
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

[Closed] Excel - this one might even be difficult

21 Posts
8 Users
0 Reactions
53 Views
Posts: 25815
Full Member
Topic starter
 

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


 
Posted : 30/12/2015 8:13 pm
 lerk
Posts: 185
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


 
Posted : 30/12/2015 8:25 pm
Posts: 0
Full Member
 

^that


 
Posted : 30/12/2015 8:27 pm
Posts: 0
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?


 
Posted : 30/12/2015 8:27 pm
Posts: 0
Free Member
 

Beaten to it...


 
Posted : 30/12/2015 8:29 pm
Posts: 10761
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.


 
Posted : 30/12/2015 8:31 pm
Posts: 25815
Full Member
Topic starter
 

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


 
Posted : 30/12/2015 8:33 pm
Posts: 25815
Full Member
Topic starter
 

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


 
Posted : 30/12/2015 8:36 pm
Posts: 0
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.


 
Posted : 30/12/2015 8:36 pm
Posts: 0
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.


 
Posted : 30/12/2015 8:38 pm
Posts: 41642
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!


 
Posted : 30/12/2015 8:38 pm
Posts: 25815
Full Member
Topic starter
 

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> 😳


 
Posted : 30/12/2015 8:40 pm
Posts: 0
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.


 
Posted : 30/12/2015 8:43 pm
Posts: 10761
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


 
Posted : 30/12/2015 8:44 pm
Posts: 0
Free Member
 

Drag that down over all rows of data.


 
Posted : 30/12/2015 8:45 pm
Posts: 25815
Full Member
Topic starter
 

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 !!)


 
Posted : 30/12/2015 8:45 pm
Posts: 25815
Full Member
Topic starter
 

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)


 
Posted : 30/12/2015 8:49 pm
Posts: 0
Free Member
 

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


 
Posted : 30/12/2015 8:51 pm
Posts: 10761
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.


 
Posted : 30/12/2015 8:56 pm
Posts: 25815
Full Member
Topic starter
 

Thanks all

just found [url= http://www.mrexcel.com/forum/excel-questions/436061-visual-basic-applications-insert-blank-row-after-repeating-cell-values-column.html ]this[/url] 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 ?


 
Posted : 30/12/2015 9:17 pm
Posts: 0
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.


 
Posted : 30/12/2015 9:32 pm
Posts: 10315
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


 
Posted : 30/12/2015 9:33 pm

6 DAYS LEFT
We are currently at 95% of our target!