I am trying to create X and Y coordinates in Excel based on my first column which is 1- 100. I am not able to achieve the desired result.Attached Screenshot
I have only 1 column which is Path and based on that I need to derive X and Y. Note : Simple formula would suffice the needs. Not looking for VBA Code.
+------+------+----+
| Path | Y | X |
+------+------+----+
| 1 | 1 | 1 |
| 2 | 0.5 | 2 |
| 3 | 1.5 | 2 |
| 4 | 0 | 3 |
| 5 | 1 | 3 |
| 6 | 2 | 3 |
| 7 | -0.5 | 4 |
| 8 | 0.5 | 4 |
| 9 | 1.5 | 4 |
| 10 | 2.5 | 4 |
| 11 | -1 | 5 |
| 12 | 0 | 5 |
| 13 | 1 | 5 |
| 14 | 2 | 5 |
| 15 | 3 | 5 |
| 16 | -1.5 | 6 |
| 17 | -0.5 | 6 |
| 18 | 0.5 | 6 |
| 19 | 1.5 | 6 |
| 20 | 2.5 | 6 |
| 21 | 3.5 | 6 |
| 22 | -2 | 7 |
| 23 | -1 | 7 |
| 24 | 0 | 7 |
| 25 | 1 | 7 |
| 26 | 2 | 7 |
| 27 | 3 | 7 |
| 28 | 4 | 7 |
| 29 | -2.5 | 8 |
| 30 | -1.5 | 8 |
| 31 | -0.5 | 8 |
| 32 | 0.5 | 8 |
| 33 | 1.5 | 8 |
| 34 | 2.5 | 8 |
| 35 | 3.5 | 8 |
| 36 | 4.5 | 8 |
| 37 | -3 | 9 |
| 38 | -2 | 9 |
| 39 | -1 | 9 |
| 40 | 0 | 9 |
| 41 | 1 | 9 |
| 42 | 2 | 9 |
| 43 | 3 | 9 |
| 44 | 4 | 9 |
| 45 | 5 | 9 |
| 46 | -3.5 | 10 |
| 47 | -2.5 | 10 |
| 48 | -1.5 | 10 |
| 49 | -0.5 | 10 |
| 50 | 0.5 | 10 |
| 51 | 1.5 | 10 |
| 52 | 2.5 | 10 |
| 53 | 3.5 | 10 |
| 54 | 4.5 | 10 |
| 55 | 5.5 | 10 |
| 56 | -3 | 11 |
| 57 | -2 | 11 |
| 58 | -1 | 11 |
| 59 | 0 | 11 |
| 60 | 1 | 11 |
| 61 | 2 | 11 |
| 62 | 3 | 11 |
| 63 | 4 | 11 |
| 64 | 5 | 11 |
| 65 | -2.5 | 12 |
| 66 | -1.5 | 12 |
| 67 | -0.5 | 12 |
| 68 | 0.5 | 12 |
| 69 | 1.5 | 12 |
| 70 | 2.5 | 12 |
| 71 | 3.5 | 12 |
| 72 | 4.5 | 12 |
| 73 | -2 | 13 |
| 74 | -1 | 13 |
| 75 | 0 | 13 |
| 76 | 1 | 13 |
| 77 | 2 | 13 |
| 78 | 3 | 13 |
| 79 | 4 | 13 |
| 80 | -1.5 | 14 |
| 81 | -0.5 | 14 |
| 82 | 0.5 | 14 |
| 83 | 1.5 | 14 |
| 84 | 2.5 | 14 |
| 85 | 3.5 | 14 |
| 86 | -1 | 15 |
| 87 | 0 | 15 |
| 88 | 1 | 15 |
| 89 | 2 | 15 |
| 90 | 3 | 15 |
| 91 | -0.5 | 16 |
| 92 | 0.5 | 16 |
| 93 | 1.5 | 16 |
| 94 | 2.5 | 16 |
| 95 | 0 | 17 |
| 96 | 1 | 17 |
| 97 | 2 | 17 |
| 98 | 0.5 | 18 |
| 99 | 1.5 | 18 |
| 100 | 1 | 19 |
+------+------+----+
My formula for x in D2 is
=IF(A2<=50,ROUNDUP((SQRT(1+8*A2)-1)/2,0),20-ROUNDUP((SQRT(1+8*(101-A2))-1)/2,0))
and for y in E2 is
=IF(A2<=50,-0.5*(D2-1)+A2-(D2-1)*D2/2,-0.5*(19-D2)+A2-100+(20-D2)*(21-D2)/2)
(if you wanted to get y directly from Path, you would have to substitute the first formula for D2 all the way through the second formula).
These formulas come from the fact that the number of rows r up to the last appearance of a certain number n in the x column is a triangular number so:
r=n*(n+1)/2
and you can solve this for n to give the number in terms of the row:
n=(sqrt(1+8*r)-1)/2