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

Excel

6. Tables, Sorting and Filtering

An order list needs room to grow

A shift starts with ten orders in a worksheet and a checked total of ₹2,870. A teammate types a new order worth ₹367 immediately below the list. The order appears on screen. The total from yesterday still displays ₹2,870 because its formula ends on the old last row. Today you will give the list a clear boundary and verify which calculations follow it.

This chapter uses fictional Blinkit and Amazon Now orders. The platform names make the examples easy to recognize. Every order, amount and report policy is invented for practice. None describes either company's actual reporting process. Use an expendable workbook copy when you sort, filter or change the sample range.

Ask three questions when a list changes

  1. Which records belong to the dataset? A row belongs to the Table only when its cells fall within the Table object. A value visible in the worksheet can sit outside that object.
  2. Which records do you want to see at the moment? A filter can hide rows that do not match a condition. Those rows remain part of the dataset. The visible subset is useful while reviewing a specific city or status.
  3. Which records should a calculation use? An all-rows total and a currently visible total serve different purposes. The formula needs to express the population in the label.

A structured reference uses a Table name and its columns rather than only cell addresses. For a Table named tblDispatch, tblDispatch[Amount] refers to its Amount data column. It can follow the Table's data rows as membership changes. You still need to verify that a new row joined the Table before trusting an updated report.

Prepare one clean record per row

Use the ten-row worksheet from the Formulas and Functions chapter, or enter the sample below. Rename the practice tab Dispatch so you can work on this copy without changing the chapter's original examples. The exercise keeps the same order identifiers and fields. Make a second untouched copy of it so you can always compare an order's original values after sorting.

Start A1 with Order ID and end I1 with Status. No title or summary should be inside A1:I11 unless it really is a field or a record. Place notes and totals in separate cells. A header describes what each column contains, and a data record has one value for each field. One record can have multiple purchased units in Qty and still count as one order.

Use rows 2–11. Date is day month year, Amount is rupees, Mins is a numeric elapsed-minute field.
RowA Order IDB DateC CityD PlatformE CategoryF QtyG AmountH MinsI Status
2BLK-10012 Nov 2026PuneBlinkitDairy2649Delivered
3BLK-10022 Nov 2026NashikBlinkitFruits327012Delivered
4AMN-10033 Nov 2026PuneAmazon NowSnacks111014Delivered
5BLK-10043 Nov 2026NagpurBlinkitFruits224011Cancelled
6AMN-10054 Nov 2026KolhapurAmazon NowDairy423216Delivered
7BLK-10064 Nov 2026PuneBlinkitBakery51508Delivered
8BLK-10075 Nov 2026SolapurBlinkitHome1129918Delivered
9AMN-10086 Nov 2026Sambhaji NagarAmazon NowStaples319510Returned
10BLK-10097 Nov 2026PuneBlinkitSnacks222013Cancelled
11BLK-10108 Nov 2026NashikBlinkitFruits19017Delivered

Check the types and headers before inserting a Table

  • Keep ID as text. It connects a record to its original identity. If the same ID can appear on several item lines, first understand what one row represents. These exercises have one distinct order ID per row.
  • Enter Qty, Amount and Mins as numbers. Use a format to show currency or make a heading explain the unit. A pasted number stored as text can affect numeric filters and totals.
  • Use dates Excel can calculate with. You can build the given dates with DATE and explicit year, month and day. When the sheet uses a particular date format, verify one date whose day and month could otherwise be swapped.
  • Keep one heading per column and avoid blank or duplicate header labels. Blank headers and duplicates can lead Excel to add or adapt names automatically, which changes the structured references you should type.
  • Use the Practice copy for learning and the original tab to verify column identities. That helps you detect accidental sorting of a single column that separated an amount from its ID.

Lab 1 · Compare a fixed address with a growing Table

Use two copies of the Dispatch data. Name the copies Fixed and TableLab. Both should have the original ten records and no filters. You will enter the same additional record in both copies, using the next empty row. Use direct typing and membership checks so you can see the difference between changing a value and expanding a Table.

Establish the fixed-range control

  1. On Fixed, enter =SUM(G2:G11) in K2, away from the records. It returns ₹2,870. Enter =COUNT(G2:G11) in K3 and check ten numeric amounts.
  2. Keep Fixed as a normal range. It is still usable for this exercise and has a clear purpose: model a calculation explicitly tied to the original rows.
  3. On TableLab, select A1:I11. Use Insert → Table or a supported Format as Table control. Microsoft documents Ctrl+T for Windows desktop. The Mac keyboard documentation lists Command+T or Ctrl+T. Use the menu when a browser or system shortcut interferes.
  4. Confirm the displayed range and the option saying your data already has headers. After creating the Table, click one of its cells. Use the contextual Table design tools to give it the name tblDispatch. Menus vary slightly between Windows, Mac and web clients.
  5. In K2 outside the Table, enter =SUM(tblDispatch[Amount]). In K3 enter =COUNT(tblDispatch[Amount]). Verify ₹2,870 and ten. The two designs agree while their populations match.

Append the same record and inspect membership

On both copies, type BLK-1011, 9 November 2026, Pune, Blinkit, Dairy, 2, 367, 10 and Delivered into A12:I12 in that order. Use =DATE(2026,11,9) if you need to build the intended date explicitly. Type the record into the next existing worksheet row without inserting a new worksheet row inside the old data. Do not add a Total Row until after this expansion exercise.

  1. In Fixed, select the summary formula and check that it still refers to G2:G11. The old coverage still shows ₹2,870 and ten amounts. Change the reference deliberately to G2:G12 in a spare formula and prove that adding the new row can produce ₹3,237.
  2. In TableLab, click inside the Table and inspect the actual range. Typing a row directly underneath can extend it. If the new data remains outside the Table, use the table resize controls in a supported client and set the bounds through I12. The goal is to see which cells become members.
  3. After verifying membership, check K2 and K3. The existing Table formulas now show ₹3,237 and eleven numeric amounts. Their written references still use tblDispatch[Amount]. The Table includes the new row's amount.
  4. Open a new scratch tab or return to an untouched workbook copy for Lab 2. That lab uses the original ten orders so its filtered results have a stable baseline.
Both original totals are 2,870 rupees. Appending order BLK-1011 with 367 rupees leaves the fixed range unchanged and increases the expanded Table total to 3,237.
The difference comes from membership. The new amount is on the sheet in both copies, and only the Table expanded to read it automatically once row 12 joined.

Trace one order from entry to summary

  1. Start with matching populations

    Both formulas read the ten original orders. Each calculates ₹2,870.

  2. Type the next order

    Row 12 now contains the invented BLK-1011 amount of ₹367 on both copies. A row being visible does not establish which formulas read it.

  3. Verify the Table expanded

    Inspect the Table boundary and resize if necessary. The Table Amount column now has eleven numeric values. The explicit fixed address in the control still has ten.

  4. Check the predicted difference

    The Table amount becomes ₹3,237. Subtract the original total of ₹2,870 to confirm the expected addition of ₹367.

Sort, filter and aggregate for different reasons

Sort when the records should appear in a new order

Sorting rearranges the matching data as a set of records. You can put cities in alphabetical order and then amounts from highest to lowest within each city. These are two sort keys. The first one defines the main grouping. The second orders rows that match on the first key. In this exercise every order's ID, status and other fields must move along with its amount.

If you select only a numeric column and sort just those cells, you can detach amounts from their original rows. That makes the report look organized while mixing old IDs with new amounts. Select a proper Table or the whole data block, and verify a recognizable record after sorting. Keep a stable sequence or original data copy if you need to restore the import order.

Filter when you want to see a subset of the same list

Filtering by City Pune and Status Delivered keeps the qualifying rows visible and temporarily hides the others. Clearing the choices exposes the rest again. Filtering does not assign a new city and does not delete the hidden records. A Table can also use slicers, which are visible button controls linked to its filter state. For Table slicer creation, Microsoft's current instructions specify the desktop Excel clients for Windows and Mac. Web creation is limited to local PivotTable slicers.

Aggregate according to the population in the label

An aggregate is a summary such as a sum, count or average over a group. A normal SUM across the Table Amount data includes the submitted rows even when a filter hides some of them. SUBTOTAL can report an amount for the visible subset. You can calculate both and label them so a teammate knows which figure answers their question.

Lab 2 · Verify a sorted view and two report totals

Use a fresh copy of the original ten rows. Create a Table over A1:I11 and give it the name tblDispatch if that name is free in the fresh workbook. Table names must be unique within a workbook. If you kept the Lab 1 Table in the same file, choose a different name for this second Table and substitute it in the formulas below. Put the summary formulas on a separate sheet so their cells stay visible while filtering the source worksheet.

Sort full records by city and then by amount

  1. Click one cell inside the Table and open its supported Sort dialog. Set the first level to City ascending and add a second level for Amount from largest to smallest. Confirm the selection includes the whole intended Table and that its column headings are treated as headers.
  2. Find the consecutive Pune rows. Their amounts should be 220, 150, 110 and 64. Verify the corresponding IDs in that order: BLK-1009, BLK-1006, AMN-1003 and BLK-1001. Sort the entire source together so a record retains its own status and city.
  3. Use =SUM(tblDispatch[Amount]) on the separate summary sheet and verify ₹2,870. A record-order change cannot change this sum when exactly the same numeric values remain in the Table. Check the ID-to-amount pair too, since a broken one-column sort could still preserve the grand total while breaking row identity.

Filter and reconcile the visible subset

  1. Set the City filter to Pune and the Status filter to Delivered. The Table still contains ten rows. The visible portion has three records with amounts of 150, 110 and 64, in that order. The ₹220 cancelled Pune order is hidden by the status condition.
  2. In the summary sheet, add =SUBTOTAL(109,tblDispatch[Amount]) and =SUBTOTAL(103,tblDispatch[Order ID]). Expect ₹324 and three occupied IDs. All IDs in this fixture are present, so the visible occupied-ID count equals the visible order count.
  3. Keep the grand total beside the visible sum. It remains ₹2,870. Compare with =SUMIFS(tblDispatch[Amount],tblDispatch[City],"Pune",tblDispatch[Status],"Delivered"). This criterion-based sum gives ₹324 whether those filters are active or cleared, because its written conditions select the population.
  4. For a manual-hide contrast, leave the filters active and temporarily hide the visible worksheet row whose ID is BLK-1006. Its amount is ₹150. With only two matching rows visible, the 109 total falls to ₹174 and the 103 count falls to two. A separate =SUBTOTAL(9,tblDispatch[Amount]) still includes that manually hidden row and returns ₹324. Both SUBTOTAL variants exclude rows hidden by the filter.
  5. Restore the worksheet row and clear the filter selections in the practice copy. Check that all ten records are visible again and that the three subtotal checks intended to describe that view return to their original all-visible results. The visibility tests should not edit or delete a source value.
The visible total is 2870 across ten rows, 324 across three filtered rows, and 174 across two rows after manually hiding the 150-rupee record.
A visible total can change while the source data and grand total stay the same.

Choose the worksheet structure that serves the next operation

Tables and plain ranges both belong in Excel. Give each one a role your next calculation can understand. A continuing record list benefits from an object with defined headers and a boundary, while a small set of separate assumptions or a deliberately frozen practice range can be easier to read with ordinary references. A report can combine both on different sheets.

Use a calculated column when each record needs its own result

If a Table will show the amount per unit, add a new field for that calculation. The structured expression =[@Amount]/[@Qty] reads the Amount and Qty from the current row. The at sign indicates that one record. In versions supporting calculated columns, Excel can fill a consistent formula down the Table automatically. Verify the generated formula and a known output. On BLK-1001, dividing 64 by two gives ₹32 per listed unit. A zero or missing quantity needs a stated error or review policy before you use this calculation on other sources.

Use a Total Row for a summary in the Table

Turning on the Table's Total Row gives you a summary area below the data. When you select Sum from a default Total Row dropdown, inspect the function it created. A common generated formula uses SUBTOTAL with 109. That gives a total which responds to the visible rows. An external structured SUM can still give the entire Table's Amount data subtotal, excluding the dedicated Total Row itself.

Use the Subtotal command and outlines for a different layout

The worksheet Subtotal command can insert summary lines at group breaks in an ordinary range. Sort by the grouping field first so each group stays together. A Table can have a Total Row, while the Subtotal command operates on a normal range. Repeat group headings or scattered group boundaries can create separate subtotals for the same category if you fail to organize the records first.

An outline is a collapsible worksheet layout. It gives readers a way to hide detail temporarily and leave summary lines in view. Grouping a set of rows does not by itself calculate the total. Build or verify the summary values separately and tell the reader whether your total should still include the collapsed detail.

Check membership, identity and view separately

A strange total can have several causes. Use a fixed small fixture while learning the differences. When a teammate reports a mismatch, take these measurements before changing anything in the main dataset.

  • Membership. Inspect the actual range. Compare its first and last IDs against the intended data. A row immediately below the Table can be outside it even if its cells use similar formatting.
  • Identity. Pick an easily recognized record and match all its fields with the untouched copy. The same grand total alone cannot prove a sort preserved all pairings between IDs, statuses and amounts.
  • View. Read the active filters and account for manually hidden or grouped rows. A missing visible row can still exist and still contribute to an all-rows comparison.
  • Types. Try a numeric count and examine dates as stored numbers where appropriate. A text 1299 can display similarly to the number but behave differently in totals and sort order.
  • Formula. Check whether the requested result is fixed, based on specific conditions, or based on whatever is currently visible. Read the function and criterion ranges against the wording of the label.

For a brief progress check, write the expected row IDs next to the total you are reviewing. If one value changes, know whether the report should move by one order's amount or stay steady. A controlled edit on a scratch copy can prove membership and scope in less time than reading the whole formula twice.

Choose a rule people can reproduce

Imagine the same practice workbook is opened by two colleagues. One has set a City filter to Pune. The other needs the grand amount and has cleared the filter. A heading that says only Total Amount leaves it unclear why one result moves and another remains unchanged. Give each result a clear population. To prove the report, run one known change under both views.

Suppose the practice reviewer asks for Pine deliveries instead of Pune. Both a filter and a conditional formula can produce an empty result, but the reasons will be different. A filter is a view state. A conditional formula compares the literal or referenced criterion. Check the source's valid categories and the actual criteria before changing records to make the reports agree.

Make a small proof of visibility

Filter the unedited table to Pune without restricting status. The visible records total ₹544. Adding Delivered drops the ₹220 cancelled order and changes the visible total to ₹324. A formula with both fixed conditions gives ₹324 even when the other ₹220 row is visible after clearing the status filter. The two measurements differ because they perform different selections. Confirm this behavior visually with the exact four source IDs.

Choose a filter whose structure fits the question

Use header controls for a view you change often

A drop-down filter on each Table column can quickly narrow a report. City Pune combined with Status Delivered gives the intersection of these choices. If you select Pune and Nashik within the City column, the view includes either selected city, then also applies any filters active on the other columns. Read the full set of active columns before describing the visible records.

Write complex criteria in a visible block

For a request such as “Pune and Delivered, or Nashik above ₹200,” the criteria can have two separate branches. The Advanced Filter lesson shows how a worksheet criteria block can express those conditions on rows. A suitable worksheet command may copy matching rows to another location as a result set. Its criteria and copy behavior differ from simply clicking header choices, so maintain a separate test copy with matching headers and verify the returned IDs.

Check what the summary should do with error values

The AGGREGATE function has specific options for ignored values. It can help when a defined report intentionally skips certain errors or hidden rows. First decide whether a source error should exclude an amount or should interrupt a report that needs complete data. Neither a visible subtotal nor an error-skipping function can establish that the missing input was safe to leave out. The dedicated lesson uses controlled examples to verify option codes and expression limitations.

Table filters, column sorting, outline grouping and worksheet summary commands all interact with rows. They do so in different ways. Keep the raw dataset intact and choose the least complicated operation that expresses the intended report.

Follow the chapter from a clean range to a verified report

Before you start, be comfortable reading a cell address and entering a numeric value. The chapter on Excel basics covers the worksheet grid and references. The conditional sums lesson explains how to turn a reporting condition into a formula. This chapter adds the dataset boundaries and visibility checks those calculations can use.

Build the Table and understand its references

  1. Create Excel Tables with deliberate headers, a verified data range and a clear name.
  2. Read structured references by distinguishing a Table column, a current-row cell and sections such as headers or totals.
  3. Add and verify a Total Row with sum, count and view-state checks.

Organize and review the order records

  1. Sort by multiple fields and custom order while preserving each order's identity.
  2. Use AutoFilter to combine visible choices and clear the specific filter that no longer applies.
  3. Set Advanced Filter criteria and verify the results against known AND and OR cases.
  4. Compare SUBTOTAL and AGGREGATE with explicitly filtered, hidden and error cases.
  5. Insert grouped summary rows with the worksheet Subtotal command on an ordinary range.
  6. Group and outline a worksheet to control which details a reader can expand.

Choose the right structure for a reusable workbook

  1. Compare a range and an Excel Table under the changes each needs to handle.
  2. Write reusable formulas in both layouts and check where the references and calculated columns change.
  3. Combine Table sorting and filtering without losing track of data membership and row order.
  4. Add a Table slicer and verify the linked filter in a supported client.

Finish with the practice and answer key. Keep at least one known row for each filter and one deliberate append, sort and clear operation as controls. The same skills transfer to later PivotTable reporting and source preparation.

Leave a checked workflow for the next import

Make a short note above or beside the practice report that identifies the actual Table and the expected fields. State that one record represents one order. State whether the displayed table has active view filters, and describe each summary as all rows, fixed criteria or currently visible. Another person should be able to reproduce the result without knowing which order you entered first.

  1. Keep a copy of the raw import and a separately labeled working list. Verify record counts and a couple of exact ID pairings after conversion or sorting. A sum alone will not detect a changed relationship between fields.
  2. Identify the existing last row before appending. Record its Table address and baseline amount. Append a known record, then inspect the new address and label. A change to the number of worksheet rows is not enough unless the intended Table includes it.
  3. Write one tested filter example in the report notes. Pune and Delivered should show three original records with ₹324 in the baseline. Keep that fixture even when future imports add more orders. It gives you a stable way to test changes to formulas and filters.
  4. Record which operations can affect the visibility of rows. A manual hide, outline collapse and filter can all reduce the rows you see. Decide which of those states the visible total is supposed to honor.

As an extra worked check, return to the expanded Table from Lab 1 after confirming that BLK-1011 joined. Filter to Pune and Delivered. The visible subtotal should now be ₹691 from four records, since the new order in that group contributed ₹367 to the former ₹324. The grand sum is ₹3,237. Clearing the filters exposes all eleven rows, while the fixed-condition result remains ₹691. This check ties membership, visibility and a stated criterion together in one controlled change.

Give the data a way back to its original order

Sorting the working copy changes which record appears in each row. Reversing an alphabetical sort does not automatically recreate the original import order. The practice IDs include different prefixes and happen to appear in a known sequence in the fixture. In another export, neither an ID nor a date necessarily records insertion order. Before running several sorts, give the working copy a separate numeric Import sequence field whose values are 1 through 10 in the original order.

Use stored numbers as the sequence in this exercise. A formula that recalculates solely from the worksheet row number can produce a different value after sorting, and would not preserve that independent order. Sort by the sequence to recreate your baseline view. Verify one record whose date is shared with another order. On 2 November the first two orders share the same date, so the date alone does not specify which came first. The sequence resolves that question plainly.

A framework like this also makes screenshot examples easier to reproduce. Save the starting worksheet name, Table name and relevant filter state with your test. An image of a value without its source state is harder for somebody to verify later.

Quiz · identify what changed

A new record is visible in row 12. Why could a formula still return ₹2,870?

The formula may still read the original G2:G11 range. If it refers to a Table column, verify that the row actually became part of the Table. Visibility on the sheet does not define table membership.

What does [@Amount] mean inside the Table?

It reads the Amount from the current data row. That is useful for a per-order result. The full Table Amount column is a different reference and can be used for a grand summary.

What amounts remain visible with Pune and Delivered selected?

The three original values are 150, 110 and 64 in descending order. The Pune cancelled amount of 220 is hidden by the status condition. Their visible sum is ₹324.

Does the grand structured SUM change when you filter these same ten rows?

It still reads every amount in the Table and gives ₹2,870. A subtotal designed for visible rows changes with the filter selection, which answers a different question.

Do SUBTOTAL 9 and 109 handle a manually hidden row the same way?

Both leave filtered-out rows out. The 9 sum includes manually hidden rows, while 109 also excludes them. The lab's visible amount falls from ₹324 to ₹174 only for the latter when the ₹150 row is manually hidden.

Which evidence catches a single-column sort that broke order identity?

Compare each selected ID with its original amount, city and status. A grand total alone may remain the same after an incorrect partial sort. Verify a known record that moved to a new row.

Interview practice · support each answer with a small test

When would you use a Table instead of an ordinary range?

I would use a Table for a growing record list whose headers, calculated fields and references should move with its membership. I would keep an ordinary range for a fixed control sample or unrelated configuration inputs. I would test one appended record to verify the intended behavior.

How would you verify a multi-level sort?

I would check that the primary grouping is correct, then verify the secondary order within a group. I would match a few IDs to their original fields and keep the original order in a reference copy for comparison.

How would you build a total that follows the current view?

I would choose the appropriate SUBTOTAL function number and label it visible total. I would compare it with an all-rows sum and verify the two on a deliberate filter. If manual hiding matters, I would test that state separately to verify the intended option.

When is a fixed-criteria total useful next to a visible total?

It is useful when a stakeholder asks for the same group regardless of the viewer's filter choices. I can use a formula with explicit Pune and Delivered conditions and keep a separate visible sum for ad hoc inspection.

How does a Table slicer relate to the data?

It offers a visible interface for setting a filter on its linked Table. I would confirm that clearing it restores the expected records and totals under the workbook's rules. I would verify the actual client supports the Table slicer actions a collaborator needs.

Six cards for the next worksheet

  • Table boundary Check the Table address and a numeric count after appending rows.
  • Structured reference Use named Table columns for population summaries. Inside a row formula, @ indicates the current record.
  • Sort Order full records by chosen keys. Confirm a known ID stays with its own fields.
  • Filter Show a subset while keeping all the records available. Record the active criteria.
  • Summary State whether the result uses the full Table, written criteria or visible rows.
  • Outline Collapse detail for presentation and verify separately whether it should still contribute to the summary.

Download the original practice cards for normal ranges and Excel Tables and SUBTOTAL and AGGREGATE. They use small independent examples. More chapter cards are available in Ravi Sir's Cards.

Microsoft references