Hi Aladin,
Thank you very much for such concise formulas. It took me a while to reply because I have been testing your formulas. I got them to work on the simple data set above. However, I got error messages when I expanded and tested these on an actual and very large data set. The error messages appear when I edit the dynamic data set or when I reposition the table or I insert rows or columns to the worksheet.
These are my follow-up questions:
1) Does the data source have to be in the same worksheet as the formulas or can I refer to the data source in another worksheet by naming the range RData in the Name Manager?
2) What did you mean by the underlined portion in your statement "1) A2:A9 is defined in Name Manager as RData (If need be, the definition can also be dynamic.)"?
3) I noticed that when using the Name Manager to delineate the source data, absolute reference ($) signs are added to the range reference. Is this ok?
4) Your formula for C2, =IF(ROWS($C$2:C2)<=$B$1,INDEX(Data,MATCH(0,COUNTIFS(Data,"<"&Data)-SUM(COUNTIFS(Data,"="&C$1:C1)),0)),""), refers to the range C$1:C1 which in the above table is occupied by the heading "Sorted". Is this ok?
5) Do I have to CSE, where required, every time there is a change in the data set?
6) I noticed that I had to be careful with the =OFFSET(Sheet1!$B$2,0,0,Sheet1!$B$1) part because I do have to use other worksheets for other data sets in the same workbook. Instead of using just one formula, I created several of these and labeled these appropriately such that the appropriate component where the "Sheet1!" part of your original formula is used. Is this ok?
7) Do your formulas work only if the table and formula are positioned as you showed above? What happens if additional rows or columns are added? Would the formula automatically adjust?
For the count formula, I modified it a bit so that it does not return a count for the number of blanks cells after the last count. I used "=if(B2="","",COUNTIFS(RData,C2)".
Thanks again. I appreciate your help very much. I am not an expert and I am learning as I go along. I just learned how to use the Name Manager because you mentioned it earlier.
Cheers!