I've been banging my head against this for a few hours, and have written a bunch of code that doesn't work.

I'm asking this in the math forum because I only want algorithmic advice... pseudo-code is fine.

I'm working in PHP with a class that generates excel files from stuff in a database. Context isn't important, but basically I need to convert a column number, such as 23, into the excel representation of that column (in this case W). This might sound very simple, but for numbers over 26, it gets very complicated. The function I write should be able to take 2358 as input, and return "CLR" as output, for example.

for those who aren't familiar, the excel numbers go like this:
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC......BA,BB,BC....etc

any help figuring this out would be greatly appreciated