• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Most profitable value based number of columns selection

Zubairsalam

New Member
Hi team I have joined this forum today and need your help on the last bit of my complex formula, I want to link my formula with the cell B7 which contained data validation, so based on changing the number of columns I need headings on line 8, 9 & 10.

Further if existing formulas need any correction, please advise, because I feel its too long to understand.

1738092051219.png
 

Attachments

  • Excel help 12.xlsx
    103.8 KB · Views: 3
I assume you do not have Excel 365? If you do, the formula might be
Code:
= LET(
    gross,  sales - cost,
    net,    gross - expense,
    values, VSTACK(sales, cost, gross, expense, net),
    order,  SWITCH(view,
      "Scenario by years", CHOOSEROWS(headers, 1),
      "Years by scenario", CHOOSEROWS(headers, 2),
      "Most Profitable",   -net),
    sorted, SORTBY(VSTACK(headers,values), order),
    sorted
  )
 

Attachments

  • Excel help 12.xlsx
    107.9 KB · Views: 3
Many thanks Peter, may be I have not explained you correctly, I want to link this with cell B7 and for example we have selected 10 then the headings of 10 top NP should appear as descending order.
 
My challenge was replicating what you had with a formula I could understand. Once that is done, selecting the 10 top NP should be easy
Code:
= LET(
    gross,  sales - cost,
    net,    gross - expense,
    values, VSTACK(sales, cost, gross, expense, net),
    order,  SWITCH(view,
      "Scenario by years", CHOOSEROWS(headers, 1),
      "Years by scenario", CHOOSEROWS(headers, 2),
      "Most Profitable",   -net),
    sorted, SORTBY(VSTACK(headers, values), order),
    TAKE(sorted, , outputColumns)
  )
1738140852934.png
 

Attachments

  • Excel help 12.xlsx
    107.2 KB · Views: 3
Back
Top