This only works for older excel which is limited to 256 columns
xlcell=: 3 : 0
'c r'=. y
c1=. <.c%26 [ c2=. 26|c
' '-.~(c1{' ABCDEFGHI'), (c2{'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), ": 1+r
)
Чтв, 16 Дек 2010, Tracy Harms писал(а):
> I encountered the question of how to produce the alphabetic label for a
> given column in Excel. I enjoyed analyzing the problem, and I enjoyed coding
> a solution in J.
>
> I notice that I have difficulty "ironing out" the program I've written.
> There is a need to use several calculated results more than once and I'm not
> particularly happy with how these are structured in the program I've
> written, especially the last half.
>
> What I'd particularly like is to have the "central" calculation shine
> through more visibly. I'm thinking about
> (howmany # Base) #: Value
>
> Would anybody like to restructure this, or provide alternative solutions to
> this problem?
>
> --
> Tracy
>
>
>
> convert=: 3 : 0
> Base =. # Digits=. 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
> offset=. [:+/ [^ [:>: i.@:]
> om =. ( * 0<]) @ <. @ ^. NB. order of magnitude, in chosen base (x)
> OM =. Base om y
> Value =. ( - Base offset"0 OM"_ ) y
> ((OM + _1<Value) # &.> Base ) (Digits{~ #: )&> Value
> )
>
> NB. 'example execution
> convert (] , (24+]) , (700+])) i.4
> A
> B
> C
> D
> Y
> Z
> AA
> AB
> ZY
> ZZ
> AAA
> AAB
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm