title: Mathematical transpose in excel
body: <p>Good day everybody!
  I'm currently trying to figure something out in excel before implementing in it VBScript. I have to mathematically transpose a few cells (10*10 or 5r*10c) in a matrice:</p>
  
  <pre>-------------------------------
  | .. | .. | .. | .. | .. | .. |
  | 21 | 22 | 23 | 24 | 25 | .. |
  | 11 | 12 | 13 | 14 | 15 | .. |
  |  1 |  2 |  3 |  4 |  5 | .. |
  -------------------------------</pre>
  
  <p>Must become</p>
  
  <pre>-------------------------------
  | .. | .. | .. | .. | .. | .. |
  |  3 | 13 | 23 | 33 | 43 | .. |
  |  2 | 12 | 22 | 32 | 42 | .. |
  |  1 | 11 | 21 | 31 | 41 | .. |
  -------------------------------</pre>
  
  <p>Now I'm not a mathematician (I'm more ore less a programmer at the moment), but I came up with: <code>F(y)=((MOD(x,10)-1)*10)+(1+((x-MOD(x,10))/10))</code> (<code>x</code> is the value in the pre-block a the top, <code>y</code> is the value in the pre-block below.) Now this works fine up to a certain point (e.g. <code>10</code>).</p>
  
  <p>In VBScript, I wrote the below at first:</p>
  
  <pre>
  Function GetPosInSrcRack(Pos)
      Dim PlateDef(9), x, y, i, tmp
  
      ' Plate Definition
      ReDim tmp(UBound(PlateDef))
      For x = 0 To UBound(PlateDef)
          PlateDef(x) = tmp
      Next
  
      i = 1
      For x = 0 To UBound(PlateDef)
          For y = 0 To UBound(PlateDef(x))
              PlateDef(x)(y) = i
              i = (i + 1)
          Next
      Next
  
      'Dim msg ' Check definition
      'For x = 0 To (UBound(PlateDef))
      '    msg = Join(PlateDef(x), ", ") & vbCrLf & msg
      'Next
  
      ' Get the Position
      y = (pos Mod 10)
      x = ((pos - y) / 10)
  
      GetPosInSrcRack = PlateDef(y)(x)
  End Function
  </pre>
  
  <p>Which, of course, works but is crappy.</p>
  
  <p>Using the above formula I would write:</p>
  
  <pre>
  Function GetPosInSrcRack(Pos)
      Pos = (((Pos MOD 10)-1)*10)+(1+((Pos - (Pos MOD 10))/10))
  End Function
  </pre>
  
  <p>But like I said, this still is incorrect (10 gives -8)
  Can somebody help me?</p>