Reputation: 3122
In Google Sheets,
I want to achieve a serial numbering system in a specific manner which satisfies the following requirements:
Test Cases:
Can anyone please provide a formula or steps to implement this feature in Google Sheets?
Upvotes: 1
Views: 847
Reputation: 862
Try this:
If you need to reflect the alphabetical order of column B:
=ArrayFormula(if(B:B<>"",counta(B:B)+1-match(B:B,sort(B:B,1,TRUE),0),))
If you just need to reflect the index / position of the value in column B:
=ArrayFormula(if(B:B<>"",counta(B:B)+1-match(B:B,filter(B:B,B:B<>""),0),))
Not sure about the spec #3, though, so I may have missed something.
If that doesn't do the trick, can you please describe what you've tried already, and maybe share an example spreadsheet that doesn't contain confidential info, and that would contain the expected result for each of your use cases?
Upvotes: 2
Reputation: 1
use this formula:
=ARRAYFORMULA(IFERROR(VLOOKUP(ROW(B:B)&B:B, QUERY({SORT({ROW(
INDIRECT("B1:B"&COUNTA(B:B))), FILTER(ROW(B:B)&B:B, B:B<>"")}, 1, 0), ROW(
INDIRECT("B1:B"&COUNTA(B:B)))}, "select Col2,Col3", 0), 2, 0)))
Upvotes: 3