Forum Discussion

Tsmarsco's avatar
Tsmarsco
Copper Contributor
Aug 23, 2024

How to Post a Cumulative Rank for a Stock to Each Quarters Data

Hi, I have 2000 stocks with quarter profits data by row for 26 years. I have summed up each firm total profits for all years on a Pivot table and got a Rank for them, e.g. Walmart is No. 1, Exxon no. 2. How do I get the Rank posted next to each quarter of data on my detailed excel page?

  • Tsmarsco 

     

    As SergeiBaklan has said, the third parameter in your use of VLOOKUP is the error. It should be consistently the number 2, i.e., the second column in the table in which you're seeking the corresponding rank of the company.

     

    =VLOOKUP(C2,$C$2:$D$4,2,0)
  • mathetes's avatar
    mathetes
    Silver Contributor

    Tsmarsco 

    I have 2000 stocks with quarter profits data by row for 26 years. I have summed up each firm total profits for all years on a Pivot table and got a Rank for them, e.g. Walmart is No. 1, Exxon no. 2. How do I get the Rank posted next to each quarter of data on my detailed excel page?

     

    As someone who also likes to analyze my investment results, likes also to use Pivot Tables for purposes like the summary you're describing, I find myself wanting to answer your question with "Why? Why would you need or want to do that?" That's why you use the Pivot Table in the first place. You can always update it with next quarter's data and see the rankings there again--which might change from last quarter's summary. 

     

    That said, if you persist in wanting to do that adding a column to your raw data file, I should think an XLOOKUP referring to the stock symbol as the thing to be searched for, the Pivot Table as the table to be searched. Come to think of it, maybe just use MATCH, which would return the row in the Pivot Table where the stock symbol is found in the ranking.

    • Tsmarsco's avatar
      Tsmarsco
      Copper Contributor

      mathetes Thanks I will try it.

       

      As you are curious, I am doing economic statistical research and I need to feed the software with time series data by rank to prove my thesis as to characteristics of firms that are more successful. It's very involved but the software requires I identify each data point with its related ranking firm.

      • mathetes's avatar
        mathetes
        Silver Contributor
        Thanks for the explanation. That makes sense now, of what otherwise seemed odd, or unnecessary.

Resources