Ravindra BagaleCourses & study guides मराठी Track your progress

9. Dynamic Arrays

Excel

9.9 CHOOSECOLS, TAKE and DROP

Choose the fields and edges of a result

A manager asks for the three biggest orders, with the IDs, cities and amounts visible. The worksheet holds ten orders with nine fields. A beginner may highlight the first three rows, sort them and send the result. That operation has already thrown away seven candidates, including the largest order in this example. The report needs two choices: which records qualify and which fields a reader should see.

This lesson uses fictional Blinkit and Amazon Now order examples and a made-up Netflix-inspired session export. The IDs, amounts and timing values are teaching fixtures. We will use worksheet formulas to create separate views of the data. Removing a row or column from a formula result leaves the source cells available for other work. That lets you retry the view when the request changes.

Read array coordinates before selecting

An array is a rectangle of values. Its first column is position 1 even if the array begins in worksheet column H. In H5:J8, position 2 means worksheet column I within that array. Row 1 means worksheet row 5. All four functions below use the shape you pass in, so every intermediate expression can change how you interpret its positions.

Use a ten-row, nine-column data array called tblMini.
OperationExampleResult shape
CHOOSECOLSChoose positions 1, 3, 7Ten rows, three fields
CHOOSEROWSChoose positions 1 and −1Two rows, nine fields
TAKEKeep the first three rowsThree rows, nine fields
DROPExclude the first rowNine rows, nine fields
  • CHOOSECOLS can put fields in a new order. Select positions 7, 1 to show Amount before Order ID. Select 1, 7 to do the reverse. The formula follows the sequence you request.
  • CHOOSEROWS can select nonadjacent rows. Choose 1 and −1 to read the first and last record in the current input. It does not sort them by any field.
  • TAKE keeps an edge. Positive rows keep the start of the array and negative rows keep its end. A column argument can select the same kind of edge horizontally.
  • DROP removes an edge from the view. Positive rows omit that many from the start and negative rows omit them from the end. Use it to remove a known export wrapper from the supplied rectangle.
  • Omit an axis when you want to leave it alone. For a column-only slice, put the column count after the omitted row argument. In standard comma syntax the result looks like =TAKE(tblMini,,2) to keep the first two fields for every row.

CHOOSECOLS and CHOOSEROWS use individual positions, including negative positions counted from the end. In a table with nine columns, −1 selects field nine and −2 selects field eight. Position zero is invalid. An index outside the array bounds is invalid too. TAKE and DROP use counts rather than lists of positions. Use a positive, documented count or a deliberate negative count for the edge you need.

Microsoft identifies these four functions as Excel 2024-era functions, and its individual documentation also lists Microsoft 365 and Excel for the web. A version with foundational spill functions may lack these selectors, so verify them in the target edition using a small example. If your result needs multiple cells, create it outside an Excel Table's body. Keep the source Table name and the output anchor distinct.

Lab 1. Rank all orders before picking the top three

Enter the fixture in A1:I11 on a sheet named Mini and convert it into a Table named tblMini. Keep the field order below for the positional examples. Amount, Qty and Minutes are numbers. Enter dates in a form Excel recognizes in your region. Give the Table a header row and do not include a source subtotal.

Mini A1:I11. The key positions are Order ID 1, City 3, Amount 7 and Status 9.
Order IDDateCityPlatformCategoryQtyAmountMinutesStatus
BLK-10012 Nov 2026PuneBlinkitDairy2649Delivered
BLK-10022 Nov 2026NashikBlinkitFruits327012Delivered
AMN-10033 Nov 2026PuneAmazon NowSnacks111014Delivered
BLK-10043 Nov 2026NagpurBlinkitFruits224011Cancelled
AMN-10054 Nov 2026KolhapurAmazon NowDairy423216Delivered
BLK-10064 Nov 2026PuneBlinkitBakery51508Delivered
BLK-10075 Nov 2026SolapurBlinkitHome1129918Delivered
AMN-10086 Nov 2026Sambhaji NagarAmazon NowStaples319510Returned
BLK-10097 Nov 2026PuneBlinkitSnacks222013Cancelled
BLK-10108 Nov 2026NashikBlinkitFruits19017Delivered

Separate ranking, column selection and row selection

On a new sheet named Ranking, put Order ID, City and Amount in A1:C1. Leave A2:C4 open. Build the stages below in separate free areas while learning. When you use the combined formula, only its three-row result needs room on Ranking. Deleting a test formula later does not delete the source records.

  1. Rank the ten rows. =SORT(tblMini,7,-1) sorts all the records on the seventh field, Amount, in descending order. You can inspect the largest three amounts without losing the other fields.
  2. Choose the three display fields. CHOOSECOLS(...,1,3,7) selects Order ID, City and Amount by position in the sorted array. There are still ten records at this stage.
  3. Take the first three ranked rows. TAKE(...,3) gives a three-row, three-column report. Put the complete formula below in A2.
  4. Prove the result matches the full population. Read BLK-1007 Solapur 1,299, BLK-1002 Nashik 270 and BLK-1004 Nagpur 240. Their total is ₹1,809. None of the other orders exceeds the third amount.
=TAKE(CHOOSECOLS(SORT(tblMini,7,-1),1,3,7),3)

Try the reversed process once. Take three rows first, then sort them by Amount and select the same columns. The three amounts you sorted were 64, 270 and 110. Their descending order is 270, 110, 64 and sums to ₹444. Sorting that small result worked correctly, but it had already lost the seven other candidates. The report title should say “rank within first three rows” if that was the real question.

First rank all ten orders by amount, with 1299, 270 and 240 at the top. Select ID, City and Amount, then take the first three rows. They total 1809.
Read the formula from the innermost step to its result. The whole eligible population participates in the ranking.

Trace changes to the output dimensions

  1. Start with all records

    Ten rows by nine fields. The original first amount is 64.

  2. Sort by the amount field

    Still ten by nine. BLK-1007 moves to the top with 1,299.

  3. Choose display fields

    Ten by three. The amount is now field three in this intermediate rectangle.

  4. Keep three rows

    Three by three. The amounts 1,299, 270 and 240 reconcile to 1,809.

Change the eligible population on purpose

The source includes Cancelled and Returned. BLK-1004 qualifies for the all-status top orders because only Amount is used. To make a Delivered-only view, apply the status filter before ranking. There are seven Delivered records in this fixture. Their top three amounts are ₹1,299, ₹270 and ₹232, giving ₹1,801. The ranking step is the same. The result changes because one high-value order is ineligible under the new rule.

=LET(deliveredRows,FILTER(tblMini,tblMini[Status]="Delivered"),
     TAKE(CHOOSECOLS(SORT(deliveredRows,7,-1),1,3,7),3))

This fixed exercise has seven eligible records. If changing it into a report where a city or status setting can produce none, count the relevant matches before sorting, as in the FILTER and LET lessons. A “No matching orders” string does not turn into a nine-field array for SORT and CHOOSECOLS. Use a guarded branch to return the message instead of interpreting a display message as if it were a table.

Lab 2. Remove an export title, heading and footer from the result

A fictional watch-session export has a title, a heading row, five records and a final summary. If you use SUM across both those records and their summary, you count the minutes twice. Open a blank sheet named SessionExport. Enter the displayed block starting in A1. Leave the dash positions empty. Enter dates as real values that Excel displays in the form shown.

Source values in A1:D8. The first column of this illustration gives the worksheet row number.
RowABCD
1Session export———
2Session IDDateProgramMinutes
3WV-512 Nov 2026Short film42
4WV-525 Nov 2026Workshop27
5WV-534 Nov 2026Feature36
6WV-541 Nov 2026Short film18
7WV-553 Nov 2026Feature42
8Minutes total——165
  1. In an empty region try =DROP(A1:D8,2). It leaves six rows, starting at WV-51 and ending at Minutes total. Understand the intermediate array before using it as a data set.
  2. In J2 paste the nested formula below, with J2:M6 clear. The outer DROP removes the final row of that six-row result, so you get five sessions and four fields.
  3. In O2 use =SUM(CHOOSECOLS(J2#,4)). Verify 165 minutes. The contaminated input would instead give 330 if you summed all eight rows' fourth field without excluding the numeric footer.
  4. Independently count five IDs and inspect WV-51 as the first and WV-55 as the last record. Both should appear in a cleaned report. The footer is no longer a candidate for a per-record chart.
  5. To show only session ID and minutes, put =CHOOSECOLS(J2#,1,4) in a separate position. Its result should be five by two with WV-51 and 42 in its first row.
=DROP(DROP(A1:D8,2),-1)
The source includes its title, headers, five records and total. Drop the first two rows, then the final footer. This leaves five records with 165 minutes.
The inner DROP removes the two leading lines. The outer DROP removes the last line of the resulting array.

Distinguish the last two physical records from the latest two dates

With the cleaned J2 output, =TAKE(J2#,-2) returns WV-54 and WV-55 in the current source order. It makes no claim about their dates. The latest two session dates are Nov 5 and Nov 4, belonging to WV-52 and WV-53. Use =TAKE(SORT(J2#,2,-1),2) to return those latest two first. This uses the second field of the cleaned array as the date key. Compare the two reports' titles and expected IDs before picking one.

A missing or text date would undermine the second report. Check the data type before ranking chronology. Date formatting is just display. A value that really is text can sort alphabetically. In this lab the clean order of actual date values can be checked without parsing their formatted labels. Verify that each date is entered as a date that Excel uses in normal date arithmetic.

Guard the layout when the next export changes

DROP knows positions. If a new export has no footer, blindly dropping the final row loses a real record. If an export gains a warning line above the title, dropping the first two rows still leaves its headings. On the fixed practice sheet you can inspect A1, A2 and A8 explicitly. In a repeating import, confirm the header rule and footer marker before removing rows. Use criteria based on a reliable row label or an import transformation if the row counts are not guaranteed.

Try the following simple check for this exact sample layout. The formula only performs the removal if the expected markers are in the expected cells. It returns one message otherwise. It does not validate every session field and should not be treated as an all-purpose parser.

=IF(AND(A1="Session export",A2="Session ID",A8="Minutes total"),DROP(DROP(A1:D8,2),-1),"Check export layout")

In a scratch copy, replace the footer label with Footer absent without editing the original. This check should produce the message. Restore the correct label. Now it should return the five practice records again. On a real exception, inspect the source rather than editing the label simply to get past the check. A later file might include more data rows and need a different method for identifying the footer.

Agree on a tie rule before building the ranking

Return to the ten original Mini orders. In a separate copy, append AMN-1011, 9 Nov 2026, Pune, Amazon Now, Dairy, 2, 240, 17, Delivered and confirm it is inside the Table. Now two orders tie on amount exactly at the third rank. A request for exactly three rows and a request for everyone meeting the third-place amount lead to different outcomes.

Return exactly three rows with a deterministic secondary key

Use amount descending and Order ID ascending as your two ranking keys for this exercise. The ID has no effect on an order with a different amount. It decides which of the two with 240 comes first. In the full array both keys have one value for each record. If you later change the records used for ranking, derive keys from that same population.

=TAKE(CHOOSECOLS(SORTBY(tblMini,tblMini[Amount],-1,tblMini[Order ID],1),1,3,7),3)

BLK-1007 and BLK-1002 keep the first two places. AMN-1011 precedes BLK-1004 at the tied 240 under the chosen alphabetical key. Expect those three IDs and a total of ₹1,809. This is reproducible. It does not imply that an alphabetically earlier order is inherently better. If the company policy favors time of transaction, use a reliable timestamp with an appropriate resolution as a different key.

Return everyone above or at the third-place amount

=LET(cutoffAmount,LARGE(tblMini[Amount],3),
     qualified,FILTER(tblMini,tblMini[Amount]>=cutoffAmount),
     CHOOSECOLS(SORT(qualified,7,-1),1,3,7))

LARGE reads the third-largest numeric amount. In the updated source that cutoff is 240. The include comparison returns four records, amount 1,299, 270, 240 and 240. Their sum is ₹2,049. This result has one extra row because it treats both tied records as qualifying. This case does not prescribe a relative order for the two ties. Derive a secondary key from the filtered array too if the report needs that extra ordering.

The cutoff formula assumes there are at least three usable amounts. An input control that triggers this report must check the number of observations. Decide whether a request for ten when four qualify should display four or a message asking for a smaller number. Keep that policy visible to the reader. A count of populated rows alone is insufficient if some amounts are invalid text.

Select edges along both axes with a small test table

In an independent scratch region point each expression below at the original ten rows of tblMini. For both rows and columns, first decide whether you want the edge itself or the rectangle that remains after excluding it. One operation preserves ten rows and reduces columns. Another reduces rows and preserves all nine fields. Enter and inspect each formula separately.

Row counts refer to the body of the original tblMini Table.
FormulaShapeCheck the top left
=TAKE(tblMini,2,-2)2 × 2Minutes 9, then Status Delivered
=TAKE(tblMini,,2)10 × 2BLK-1001, then 2 Nov 2026
=DROP(tblMini,1,2)9 × 7Nashik, then Blinkit
=DROP(tblMini,,-2)10 × 7BLK-1001, then 2 Nov 2026
=CHOOSEROWS(tblMini,1,-1,1)3 × 9BLK-1001, then 2 Nov 2026
=CHOOSECOLS(tblMini,7,1,7)10 × 364, BLK-1001, 64
  • For the first TAKE, the positive row count keeps the first two data records. The negative column count keeps the last two fields. This selection is the intersection of those row and column slices.
  • For the first DROP, remove one record and two fields from their starting edges. The new first record is BLK-1002. Its City appears at the top-left because Order ID and Date were removed from the view.
  • For the column-only DROP, the start of every record remains unchanged. The resulting final field becomes Amount. Formatting the preview cannot bring Minutes and Status back into the spill.
  • For CHOOSEROWS, the first, last and first records appear in that requested order. The duplicated first row is intentional. If your analytic result should contain each order once, review repeated indices.
  • For the final CHOOSECOLS, Amount appears twice. This can be useful when constructing a template with repeated fields, but an accidental repeated amount can make a later total misleading. Read the returned headings in their new order.

Protect field names when a Table's columns can move

Positions are convenient when the schema is fixed. If someone inserts a new field before Amount, that value might no longer be field seven. A literal field index would still point to position seven and might quietly rank Qty. To use stable field names, make the display block from the named Table columns and provide an explicit named sort key from the same population.

=TAKE(SORTBY(HSTACK(tblMini[Order ID],tblMini[City],tblMini[Amount]),tblMini[Amount],-1),3)

This expression shows the same three fields and still returns ₹1,809 across the original ten rows. Start with HSTACK of field names. The result has ten rows because they all come from the same Table and represent the same records. SORTBY receives one sort key per row. TAKE limits the sorted display to three records. Test the result in a copy where Amount is physically moved. This is also a useful example of reusing the previous lesson's alignment rule.

If you need a reusable ordered template with a larger list of fields, consider a documented mapping from requested header names to actual columns. Its missing-header result should be explicit. A wrong column can have the correct data type and a convincing total. Verify at least one controlled amount or duration against a known ID after a field mapping changes.

Let the reader choose how many ranked orders to see

Restore the original ten-order Table. Hypothetical users sometimes ask for two records or five, so place a parameter outside the output instead of editing the formula each time. On Ranking, put a label Number of orders in L2 and the requested input in M2. In a free output location enter the formula below. Reserve up to ten rows because the largest accepted input in this example is the full source.

=LET(requested,$M$2,
     IF(NOT(ISNUMBER(requested)),"Enter a number",
     IF(OR(requested<1,requested<>INT(requested)),"Enter a positive whole number",
     IF(requested>ROWS(tblMini),"Only "&ROWS(tblMini)&" orders available",
       TAKE(CHOOSECOLS(SORT(tblMini,7,-1),1,3,7),requested)))))

LET reads the requested count once. The outer test makes sure this data can be treated as a number. The next comparison protects against values such as 0 or 2.5 because rows are discrete. If the requested count is greater than the number of orders in the current Table, the chosen interface explains the available number. This is a deliberate rule for the report, separate from any default behaviour with large counts.

  1. Enter 1 and verify one row with BLK-1007 and 1,299. Enter 2 and verify two rows sum to 1,569.
  2. Enter 3 and verify the base report totals 1,809. Enter 10 and check that the full amount is 2,870 in descending order.
  3. Enter 0 or 2.5 to see the whole-number message. Enter text such as three to see the number message. Enter 11 and require Only 10 orders available.
  4. Before sharing, decide whether the report's highest-state input should show all when the request exceeds the population or prompt for a corrected number. Those are separate choices. Label the behaviour a colleague should expect.

When Excel receives an explicit zero count for TAKE, Microsoft documents an empty-array #CALC! condition. The guarded report returns a readable message for a zero request. The separate omitted-axis syntax is useful when you are selecting only one axis. For DROP, practice the documented positive and negative examples and the omitted-axis syntax. Protect requests that would leave no data rather than relying on zero as an empty output.

Practice and answer key with the source orders

Reset to the original ten-row Table and inspect the source order after each deliberate sort. The first row is BLK-1001 and the final row is BLK-1010 when the records are in the displayed fixture order. A sort formula creates a new output and doesn't sort the Table itself.

Return Order ID and Amount

Use =CHOOSECOLS(tblMini,1,7). It produces ten rows with two fields because CHOOSECOLS preserves the current record sequence. Check that the first pair is BLK-1001 and 64.

Show the first three current rows

Use =TAKE(tblMini,3). The original first three IDs are BLK-1001, BLK-1002 and AMN-1003. Their amounts total 444. This is a physical slice, which you can see by comparing the first and third fields with the original Table.

Show the last two current rows

Use =TAKE(tblMini,-2). BLK-1009 and BLK-1010 are the last two IDs. Their relative order stays the same as the source and their amounts add to 310. A negative count selects from the lower edge while preserving the chosen rows' internal order.

Count the rows after excluding the first record

Use =ROWS(DROP(tblMini,1)). The body has ten records, so there are nine after dropping one. The first record is BLK-1002. The Table's heading was already outside the array given to DROP.

Sum just the three biggest amounts

Use =SUM(TAKE(SORT(CHOOSECOLS(tblMini,7),1,-1),3)). After reducing to the Amount field its position is one. Sorting that column by field one, then taking three, yields 1,299, 270 and 240. Their sum is 1,809. Sorting at position seven at that stage would refer to a field that is no longer present.

Return the ID and amount of the least expensive order

Use =TAKE(SORT(CHOOSECOLS(tblMini,1,7),2,1),1). After selecting two fields, Amount is in position two. Sort ascending and take the first row, BLK-1001 with 64.

Describe the population the formula actually reads

In Mini, use the Table's Status filter to show only Delivered rows. Check what the full Table reference still contains. Hiding a row from the source view does not exclude it from SORT or TAKE over that complete data array. The original all-status ranking still includes the ₹240 cancelled order even when its source row is hidden. The explicit FILTER condition in the Delivered exercise produces the narrower ranking that ends at ₹232. Open the source filter after the experiment so later readers can see the original ten records.

Suppose someone says the dashboard needs the “first three visible orders.” Ask what makes them visible. If the business rule is a period and status selection, make those inputs visible and use a formula that computes that population. Let the user change an input and verify its effect. If the requirement is literally whatever three rows happen to display at the top of the source grid right now, the formula should be designed and tested for that separate view. They are different definitions and need different checks.

For a workbook handoff, also distinguish a live three-row spill from a copied three-row report. The spill recalculates from the referenced Table as amounts change. Copying values captures that result at a single moment. If a report needs to document an approval, label the snapshot with the time or version used. If it should stay current, share the formula and compatible workbook along with the data definition. Test one amount change in the practice copy and verify the ranking follows it before sharing.

Trace the intermediate size when a selector fails

A column index is correct for the source and wrong for the current input

Suppose you start with CHOOSECOLS of the Order ID and Amount fields. A later SORT may be using position seven copied from the full Table version. Temporarily place the two-field expression in a scratch area and label the columns at the top. Read ID in column one and Amount in two. Change the ranking position to two or provide a named external sort key with the same row order. Never sort by a key taken from rows after a filter if the returned array still contains the original unfiltered population.

The first entry is a heading instead of an order

Check whether you passed the Table's data body, a range beginning in data or a range starting at row 1. In Mini, =TAKE(A1:I11,1) refers to a range including the heading, so the result is the nine field labels. =TAKE(tblMini,1) reads the ten-row Table body and returns the first order. A combined report can use a separately placed header. If you include it intentionally in the result, count records independently of display rows.

Inspect a zero result, a boundary error or a blocked range

  • Invalid position. CHOOSECOLS takes one or more valid position arguments. On a nine-field array, zero, ten and −10 are outside that set. Use COLUMNS on the direct input to verify the range. CHOOSEROWS uses ROWS for the same type of check.
  • Empty result. A positive TAKE count should describe actual requested rows. Handle a deliberate no-match report before slicing, since an empty array is not the same output as a one-cell message. Verify at least one record qualifies before creating a report that expects data columns.
  • Blocked rectangle. If your report normally returns one line, a change to five can reveal a blocker in the previously unused destination cells. Leave room up to the chosen maximum. Move an unrelated control to a stable area instead of erasing it in the practice workbook.
  • Unexpected zero amount. Check whether the source amount is a genuine numeric zero or a blank presented through an array. Inspect the source record by ID. Use a separate missing-data status if the report must distinguish missing amounts from zero.

A trimmed preview finds the right values but gives an incomplete audit

The list at the top of a report is often for reading. Keep separate validation controls for the full Source. A company could display its three highest orders while still comparing all ten source orders to a payment export. The headline displays 1,809. The source sum 2,870 continues to describe all the eligible records in that source, including records the display leaves out. Since the numbers answer different questions, give both clear labels. Display footer totals and field headings where readers can see them without thinking they are ordinary order records.

For a handoff, record the formula input, selection rule, order of operations and two checked IDs. For example, “All ten orders, Amount descending, first three, display ID and City and Amount. Largest ID BLK-1007 and final displayed ID BLK-1004.” Someone can change the sort direction or status and see which side of the check should change. This makes the result a small experiment with an expected outcome.

Quiz with explained answers

Which two fields does CHOOSECOLS with 7 then 1 return?

Amount followed by Order ID in the original layout. It preserves all ten source records. The values on the first row are 64 and BLK-1001. The first selected field comes first even though field seven originally appeared to the right of field one.

Why does taking three before sorting miss the largest order?

The largest order is the seventh source record and has Amount 1,299. If you first take three, it never reaches the sort. Sorting all ten lets it move to the top. A later TAKE then returns the top group for the full population.

What does a negative two mean in the row argument of TAKE and DROP?

TAKE with −2 keeps the bottom two rows in the order they originally appeared. DROP with −2 omits the bottom two rows and keeps the rest. In the original Mini Table those last two IDs are BLK-1009 and BLK-1010. You decide whether those two or the other eight belong in the result.

How do you remove two opening rows and one closing row from the export?

Apply DROP with 2 first, then DROP with −1 to the remainder. Six rows are left after the first operation, and five after the second. The final row removed is Minutes total, which had to stay out of the record sum.

What field number should you sort after selecting Order ID and Amount only?

Two, because the array presented to SORT has only two fields and Amount is second in that array. Seven is still the position in the full original Table. Examine each function's direct input before using a numeric position.

How many rows qualify after appending another order tied at the original third-place amount?

Four rows qualify if the rule includes everybody at least as high as the third-place amount. An exactly-three report still returns three under a specified secondary key. Both results can be correct under their different definitions. The inclusive report has total 2,049 in the appended fixture.

Interview questions you can answer from practice

How do you decide whether a request means first three, latest three or highest three?

Clarify which field provides the order. First three can mean physical row position. Latest three needs a date or timestamp with a reliable type and sort. Highest three needs a measure and descending order. Then choose the eligible records and resolve ties before taking the requested subset.

When can taking a negative number of rows give the wrong recent records?

It gives the rows at the bottom of the given array. If the input is not already ordered by date in the required direction, the last rows may be old. In the session fixture, last two were WV-54 and WV-55, while the latest two dates belonged to WV-52 and WV-53. A date sort is needed to find the latter.

What could go wrong if someone inserts a new Table field?

A fixed numeric position can start pointing to a different field. I would explicitly choose named Table columns or confirm a documented mapping of position to header. Then I would check a real ID and its value after moving a field in a test copy. Correct output dimensions alone would not detect that mistake.

How would you make a fixed-format export cleanup dependable?

Record the expected title, header and footer position for that format, and test that the imported file contains those markers. Remove the exact wrapper rows and check the amount or duration sum against a separate calculation. If the export format varies, review its reliable markers and use a rule that can handle varying row counts.

How would you verify a user-controlled top-N report before sharing it?

I would test a normal request such as three, one at the boundary, the full count, too many and a zero or text input. I would verify the reported measure, data types and tie policy. I would reserve the largest required spill footprint. Each failure case should tell the reader what input it actually expects.

Revision cards

  • Choose fields by position. CHOOSECOLS reads the immediate input's field order.
  • Choose rows by position. CHOOSEROWS lets you request nonadjacent records and repeated positions.
  • TAKE keeps an edge. Use a negative count for the final rows or rightmost columns.
  • DROP trims a view. Inspect leading and trailing markers before removing export rows.
  • Sort before taking top values. A sort can only rank the records it was given.
  • State your tie policy. Exactly N with a secondary key and all records at the cutoff can produce different row counts.

Microsoft references