MrExcel Message Board


Go Back   MrExcel Message Board > The Lounge > Lounge v.2.0

Lounge v.2.0 A place to chat.

Reply
 
Thread Tools Display Modes
Old Jan 2nd, 2007, 04:31 PM   #1
MrExcel
.
 
MrExcel's Avatar
 
Join Date: Feb 2002
Location: Akron, Ohio USA
Posts: 729
Default Jan 2007 Challenge of the Month Discussion

The January 2007 challenge of the month is to find a better way to create stem and leaf charts in Excel. See the original problem at http://www.mrexcel.com/challenge.shtml
__________________
Preview my latest book for Free
MrExcel is offline   Reply With Quote
Old Jan 2nd, 2007, 05:11 PM   #2
Oaktree
MrExcel MVP
 
Oaktree's Avatar
 
Join Date: Jun 2002
Location: Chicago, IL
Posts: 7,439
Default

Hi, Bill!

I see you're looking for the "best non-VBA solution", but does "non-VBA" also exclude using the morefunc.dll add-in everyone should have?

Seems that something like

H2: {=SUBSTITUTE(MCONCAT(SMALL(IF(INT($A$2:$E$6/10)=G2,MOD($A$2:$E$6,10)),ROW(INDIRECT("1:"&SUMPRODUCT(--(INT($A$2:$E$6/10)=G2)))))),"FALSE","")} copied down would work...
__________________
"The greatest challenge to any thinker is stating the problem in a way that will allow a solution." Bertrand Russell
Oaktree is offline   Reply With Quote
Old Jan 2nd, 2007, 08:19 PM   #3
MrExcel
.
 
MrExcel's Avatar
 
Join Date: Feb 2002
Location: Akron, Ohio USA
Posts: 729
Default

I would say using MoreFunc.dll is valid, although if someone does it without MoreFunc.dll, then this would be more elegant...
__________________
Preview my latest book for Free
MrExcel is offline   Reply With Quote
Old Jan 3rd, 2007, 06:00 PM   #4
northwolves
 
northwolves's Avatar
 
Join Date: Jun 2006
Location: Taiyuan,China
Posts: 957
Default

H2=REPT(0,COUNTIF(A$8:A$32,G2*10)) &SUBSTITUTE( SUMPRODUCT(ROW($1:$9)*(10^COUNTIF(A$8:A$32,G2*10+ROW($1:$9))-1)*10^(COUNTIF(A$8:A$32,">"& G2*10+ROW($1:$9))-COUNTIF(A$8:A$32,">"& G2*10+10))/9),0,"")

Drop it down to H6
northwolves is offline   Reply With Quote
Old Jan 3rd, 2007, 06:23 PM   #5
northwolves
 
northwolves's Avatar
 
Join Date: Jun 2006
Location: Taiyuan,China
Posts: 957
Default

Another:
H2=REPT(0,COUNTIF(A$8:A$32,G2*10)) & SUMPRODUCT(ROW($1:$9)*(10^COUNTIF(A$8:A$32,G2*10+ROW($1:$9))-1)*10^(COUNTIF(A$8:A$32,">"&G2*10+ROW($1:$9))+MATCH(G2*10+9,A$8:A$32)-26)/9)

Drop it down to H6
northwolves is offline   Reply With Quote
Old Jan 4th, 2007, 02:01 PM   #6
Trances
 
Join Date: Nov 2006
Location: London, UK
Posts: 142
Default

Where can i find a list of past Challenges and submissions
Trances is offline   Reply With Quote
Old Jan 4th, 2007, 02:53 PM   #7
xld
 
xld's Avatar
 
Join Date: Feb 2003
Location: The Kingdom of Wessex
Posts: 3,667
Default

Here is a asolution that works on the original grid. It does put the results into separate cells, so it has to be copied across however many cells that there are in the grid (a use for Excel 2007?)

=IF(ISERROR(INT(SMALL(IF($A$2:$E$6-MOD($A$2:$E$6,10)=$G2*10,MOD($A$2:$E$6,10)*10^5+ROW($A$2:$E$6)*10^2+COLUMN($A$2:$E$6),""),COLUMN(A$1))/10^5)),"",
INT(SMALL(IF($A$2:$E$6-MOD($A$2:$E$6,10)=$G2*10,MOD($A$2:$E$6,10)*10^5+ROW($A$2:$E$6)*10^2+COLUMN($A$2:$E$6),""),COLUMN(A$1))/10^5))

of course it is an array formula.
xld is offline   Reply With Quote
Old Jan 4th, 2007, 02:56 PM   #8
xld
 
xld's Avatar
 
Join Date: Feb 2003
Location: The Kingdom of Wessex
Posts: 3,667
Default

It can be reduced to

=INT(SMALL(IF($A$2:$E$6-MOD($A$2:$E$6,10)=$G2*10,MOD($A$2:$E$6,10)*10^5+ROW($A$2:$E$6)*10^2+COLUMN($A$2:$E$6),""),COLUMN(A$1))/10^5)

and use conditional formatting to hide the errors.
xld is offline   Reply With Quote
Old Jan 5th, 2007, 06:54 AM   #9
markyc
 
Join Date: Aug 2006
Location: Toronto
Posts: 147
Default

Quote:
Hi, Bill!

I see you're looking for the "best non-VBA solution", but does "non-VBA" also exclude using the morefunc.dll add-in everyone should have?

Seems that something like

H2: {=SUBSTITUTE(MCONCAT(SMALL(IF(INT($A$2:$E$6/10)=G2,MOD($A$2:$E$6,10)),ROW(INDIRECT("1:"&SUMPRODUCT(--(INT($A$2:$E$6/10)=G2)))))),"FALSE","")} copied down would work...
Furthermore using morefunc.dll then this can be rewritten as:

H2: {=MCONCAT(REPT(ROW($1:$10)-1,COUNTIF(A$8:A$32,G2*10+ROW($1:$10)-1)))}

I'm trying to think of a way using pivot tables but no luck thus far.
Regards,
Mark
markyc is offline   Reply With Quote
Old Jan 5th, 2007, 06:17 PM   #10
northwolves
 
northwolves's Avatar
 
Join Date: Jun 2006
Location: Taiyuan,China
Posts: 957
Default

H2=REPT(0,COUNTIF(A$8:A$32,G2*10))& SUMPRODUCT(ROW($1:$9)*INT(10^COUNTIF(A$8:A$32,G2*10+ROW($1:$9))/9)*10^(COUNTIF(A$8:A$32,">"&G2*10+ROW($1:$9))+MATCH(G2*10+9,A$8:A$32)-25))
northwolves is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT +1. The time now is 05:06 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
All contents Copyright 1998-2009 by MrExcel Consulting.