5 Replies Latest reply on Nov 7, 2012 6:11 PM by dalia cohen

    Adding sequence number?

    dalia cohen

      I have a list of multiple orders made by multiple customers. Can I add an order sequence number for each user, so that the sequence would start over for each customer?

       

      For example:

       

      UserID   OrderID   order sequence

      123        234         1

      123        256         2

      123        456         3

      124        345         1

      124        764         2

      125        998         1

       

      Something like the equivalent of "=COUNTIF($A$2:A2,A2)" in Excel.

       

      Thanks!

        • 1. Re: Adding sequence number?
          Alex Kerin

          Absolutely - the calc is a simple:

           

          index()

           

          but then you need to set partitioning of the table calc when you use it. With the view you have here, you would use advanced, User ID on the left, Order ID on the right, sort by Order ID, minimum ascending

          • 2. Re: Adding sequence number?
            dalia cohen

            Awesome! Worked like a charm. Thanks Alex!!

            • 3. Re: Adding sequence number?
              dalia cohen

              Actually, one more question. I've added product type purchased, and it seems now the sequence is for each user - for each product type, so

               

              UserID   OrderID   product type    sequence    what I want

              123        234           book                  1                    1

              123        256           card                   1                    2

              123        456           card                   2                    3

              123        983           book                  2                    4

              124        345           book                  1                    1

              124        764           card                   1                    2

              125        998           card                   1                    1

               

              But I don't actually care about the product type - I want the sequence to be just based on the User ID. I can't figure out how to have it ignore product type, though. Help?

              • 4. Re: Adding sequence number?
                Alex Kerin

                You need to go back into the advanced drop down of the table calculation index() and move product type to the right side

                1 of 1 people found this helpful
                • 5. Re: Adding sequence number?
                  dalia cohen

                  Alex, you did it again. And at record speed. Thanks!!