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

9. Dynamic Arrays

Excel

9.4 UNIQUE

Make one line per city without removing orders

A fictional grocery coordinator has ten order records. Four were in Pune and two were in Nashik. The city team wants a list of places, followed by an amount and order count beside each place. Later someone asks which cities appeared only one time in that source. Those are two different questions. If you delete repeated city values from the original order list, you can lose the order details needed for the amount calculation. A new result using UNIQUE lets you choose a grouping key without changing the source records.

A distinct list shows one representative of every different value or combination. A once-only result includes only values whose frequency is one in the input. A repeated label can be present in the distinct list and absent from the once-only result. In the practice workbook, Pune belongs in the city revenue report even though its four orders exclude it from the once-only report. Each report should state the question it answers.

The order and customer labels here are invented for practice. The examples use familiar grocery contexts from Blinkit and Amazon Now. They do not describe any actual shopping data or company rules.

Read the comparison direction and frequency policy

The syntax is UNIQUE(array,[by_col],[exactly_once]). The first argument is the input. The second argument determines whether you compare rows or columns. The third argument chooses whether all distinct values are eligible or only those appearing exactly once. The brackets describe optional arguments. You can give the two Boolean choices explicitly when teaching a rule.

  • Row comparison is the default. When data runs down a column, every row contains one value. In a two-column range, Excel compares the values together as a row pair.
  • Column comparison is optional. Set by_col to TRUE for a layout in which each compared record is a column. Its entire set of values must match another column to be considered a repeat.
  • Distinct by default. Leave exactly_once out or set it FALSE to return one representative for each group of equal values.
  • Once-only when requested. Set exactly_once TRUE. This excludes a value entirely if it occurred more than once. It does not return one copy of every repeated value.

For a quick check, imagine the four inputs Pune, Mumbai, Pune, Pune. All distinct values are Pune and Mumbai. The only value occurring once is Mumbai. If you append a new Pune entry, the distinct source choices are still two. If you append a Mumbai entry, that city now appears twice and the once-only set becomes empty. A count of source rows, a count of distinct labels and a count of labels occurring once answer separate questions.

Pune occurs four times and Nashik twice. Both stay in the distinct list. Four cities with one occurrence enter the once-only result.
The frequency of a label matters only when you choose the once-only policy. A distinct list retains repeated groups once.

Compare complete rows only when the combination is the key

Suppose one Pune order was through Amazon Now and three others were through Blinkit. A distinct City list includes Pune once. A distinct City and Platform input gives the two rows Pune with Amazon Now and Pune with Blinkit. A two-field output is useful when you need one line per pair. If you concatenate the fields into one string first, choose a safe separator or keep the two arrays as columns. Concatenating without a separator can make different text pairs look identical, such as “AB” + “C” and “A” + “BC.” Keep two columns when the row comparison already expresses the required combination.

For an alphabetically sorted list use SORT around the distinct output or as a later separate step. Treat the result as a list with its own row order. A downstream summary should use each returned city as its actual criterion. Do not attach a separate amount list that happened to use the old order. If the city list changes or sorts differently, those two arrays can fall out of alignment.

Lab 1. Build a city summary without changing the source

On a scratch sheet called Orders enter this ten-row list. It uses the same amounts and cities as the Chapter 3 practice. City and Platform are adjacent so you can compare them as two-field rows. Convert A1:D11 to a Table named tblUnique if your client exposes the name field. Keep order IDs as text and amounts numeric.

Orders A1:D11. City repeats because each row is one order.
Order IDCityPlatformAmount
BLK-1001PuneBlinkit64
BLK-1002NashikBlinkit270
AMN-1003PuneAmazon Now110
BLK-1004NagpurBlinkit240
AMN-1005KolhapurAmazon Now232
BLK-1006PuneBlinkit150
BLK-1007SolapurBlinkit1299
AMN-1008Sambhaji NagarAmazon Now195
BLK-1009PuneBlinkit220
BLK-1010NashikBlinkit90

Compare distinct cities, once-only cities and distinct pairs

  1. List distinct cities. On a clear Summary sheet put =UNIQUE(tblUnique[City]) in A2. Verify six labels: Pune, Nashik, Nagpur, Kolhapur, Solapur and Sambhaji Nagar. Use =ROWS(A2#) in a separate cell to verify the result has six rows in this clean fixture.
  2. Find cities that occur once. Put =UNIQUE(tblUnique[City],FALSE,TRUE) at D2. Verify Nagpur, Kolhapur, Solapur and Sambhaji Nagar. Pune has four observations and Nashik has two, so both stay outside this result.
  3. Add the second comparison field. At G2 use =UNIQUE(tblUnique[[City]:[Platform]]). The result is seven distinct pairs, in two fields. Pune contributes two pairs and each other city contributes one. The number of rows in G2# is 7. Counting all populated cells yields 14 because there are two fields per row.
  4. Repeat with once-only pairs. In another clear area use the same two-field input with exactly_once TRUE. It returns five pairs. Pune/Blinkit repeats three times and Nashik/Blinkit repeats twice, so both are excluded. Pune/Amazon Now is still represented because that particular pair occurs once. Changing the comparison unit changed the frequency result.

Attach independent measures to the sorted city list

Put City, Sales and Orders in K1:M1. In K2 enter =SORT(UNIQUE(tblUnique[City])). In L2 enter =SUMIFS(tblUnique[Amount],tblUnique[City],K2#). In M2 enter =COUNTIFS(tblUnique[City],K2#). These three separate columns are useful on supporting versions where HSTACK is unavailable. The first formula returns six city criteria. The other formulas return an amount and count in that same criterion order. Keep space for each one to grow. Verify the expected results:

Original six-city result sorted alphabetically.
CitySalesOrders
Kolhapur2321
Nagpur2401
Nashik3602
Pune5444
Sambhaji Nagar1951
Solapur12991

Use Pune as the first control. The amount 544 comes from four orders at 64, 110, 150 and 220. Nashik has only two original rows and accounts for 360. Check the sum of Sales is 2,870, and the counts sum to 10. For this clean exact-label fixture, each order belongs to one city. Your total should account for every source amount once. These separate checks would reveal a missing city, a duplicated summary row or a misplaced count.

Combine aligned columns in clients with HSTACK

On an Excel client supporting LET, SORTBY and HSTACK, the same result can go in one spill. Put it on another scratch sheet or in a separate clear rectangle. Use meaningful LET names rather than a single letter that can conflict with Excel’s reference syntax.

=LET(cityList,SORT(UNIQUE(tblUnique[City])),
     salesByCity,SUMIFS(tblUnique[Amount],tblUnique[City],cityList),
     ordersByCity,COUNTIFS(tblUnique[City],cityList),
     SORTBY(HSTACK(cityList,salesByCity,ordersByCity),salesByCity,-1,cityList,1))

HSTACK places the three already aligned columns together. SORTBY uses Sales descending and City ascending for tied Sales. The output begins Solapur, then Pune, Nashik, Nagpur, Kolhapur and Sambhaji Nagar. The shape is still six by three. Sort the combined report rows as a unit so the numbers continue to describe the correct city.

Prove new membership and repeat behavior with two appended records

Append AMN-1012, Satara, Amazon Now, 367 and confirm it became a member. The city list grows to seven. The grouped amount totals ₹3,237 and counts total eleven. The sales-first report places Satara before Nashik because 367 is larger than 360. The once-only city list now includes Satara. Append AMN-1013, Pune, Amazon Now, 200. The distinct city count stays seven and the Pune count becomes five. Pune’s amount becomes ₹744 and the full total becomes ₹3,437. The Pune/Amazon Now pair now occurs twice, so it drops from the once-only pair list. Distinct pair membership is unchanged by that final append.

Lab 2. Recover category meaning from messy labels

A fictional grocery export has order records with several spellings that look almost identical on screen. You need a summary of approved city labels and an explicit line for unresolved labels. Keep the raw input as evidence. Do not delete any order rows just because their City entries repeat.

Prepare A1:D7 in the scratch sheet Import. Add blank result fields Clean City and Data Status to E1 and F1.
ReceiptCity RawPlatformAmount
EX-01PuneBlinkit100
EX-02Pune + ordinary spaceBlinkit150
EX-03Pune + nonbreaking spaceAmazon Now200
EX-04NashikBlinkit80
EX-05Leave emptyAmazon Now50
EX-06NashikBlinkit120

Enter the difference deliberately before cleaning it

  1. Use ="Pune"&" " in B3 and ="Pune"&UNICHAR(160) in B4. Leave B6 genuinely empty. These formulas put the actual spaces in the values. Do not type the words “ordinary space” or “Leave empty” into those cells.
  2. Check that B2 has length 4, B3 and B4 each have length 5. The last characters in B3 and B4 have different meanings. The ordinary space has code 32 and the nonbreaking space has code 160. Use UNICODE(RIGHT(B4,1)) in a scratch check cell to identify the latter. TRIM alone targets ordinary spaces and does not remove the nonbreaking character.
  3. Convert A1:F7 to a Table named tblMessy where supported. In Clean City enter =IF([@[City Raw]]="","",TRIM(SUBSTITUTE([@[City Raw]],UNICHAR(160)," "))). The expression leaves the missing input empty-looking and turns known special spaces into ordinary spaces before TRIM removes the trailing ones.
  4. In Data Status enter =IF([@[Clean City]]="","Review","OK"). Verify both formulas down all six rows. The clean values are Pune, Pune, Pune, Nashik, empty text and Nashik. Five rows are OK and EX-05 is marked Review.
Three raw Pune labels differ because of spaces. The cleaned Pune label has a 450-rupee total. The missing city is reported separately as 50 rupees.
Preserve the label you received. Group by the verified clean field and report unresolved records explicitly.

Build the valid label list and reconcile the missing amount

In a clear ordinary grid area enter =SORT(UNIQUE(FILTER(tblMessy[Clean City],tblMessy[Data Status]="OK"))). It returns Nashik and Pune. This controlled fixture has five OK rows. If adapting the report to a source with no approved records, check the count first and use a separate message for that state. A string like "No city labels" that is passed through UNIQUE would otherwise become a displayed value. Do not count it as an additional city.

Summarize the clean city labels using SUMIFS, referring to Clean City. Pune’s amount is ₹450 across three rows. Nashik’s is ₹200 across two. The approved-city subtotal is ₹650 from five records. Separately use =SUMIFS(tblMessy[Amount],tblMessy[Data Status],"Review") and =COUNTIFS(tblMessy[Data Status],"Review") for the unresolved ₹50 and one record. All six original amounts add to ₹700. Verify ₹650 plus ₹50 equals the complete source amount. No original row had to be removed to show a clean distinct list.

Normalize only categories whose intended meaning you have confirmed. Removing every space from every field can damage a place name or a deliberately spaced identifier. An approved mapping can assign labels such as the business spelling of Sambhaji Nagar. Standardizing case can be useful for presentation. If your organization treats two codes that differ only by capitalization as different identifiers, test the exact comparison behavior and use a case-sensitive key method where required. Do not assume the category cleanup policy is appropriate for the order ID field.

Use column comparison for a genuinely horizontal source

In a separate grid put Version A, Version B and Version C in A1:C1. In A2:C2 put 2, 2 and 3. In A3:C3 put 5, 5 and 6. Here the heading identifies a column, and the pair of numbers below it is the thing you want to compare. The labels should stay outside the comparison if the question is whether the numeric column vectors are duplicates.

  • =UNIQUE(A2:C3) compares two rows. The two rows differ, so the two-by-three result is unchanged.
  • =UNIQUE(A2:C3,TRUE,FALSE) compares three columns. The first two contain the same pair, 2 and 5. The result has two columns: the pair 2 and 5 and the pair 3 and 6. It still has two rows.
  • =UNIQUE(A2:C3,TRUE,TRUE) only returns the third numeric column with 3 and 6. The other column vector repeats, so neither repeat belongs to a once-only output.

Do not carry the original three headings across the new two-column result without adjustment. If the output should state which source version each vector came from, define a source-to-output mapping before collapsing duplicates. Keeping the header inside the input can make otherwise identical numeric columns distinct because their labels differ. That would answer a different comparison question.

Summarize combinations without merging their labels into text

The first lab introduced seven distinct City and Platform pairs. Now turn those pairs into a three-column report with one amount per pair. This is an extension of the city summary. The result must keep two separate criteria because a Pune Blinkit order and a Pune Amazon Now order are distinct groups. The amount should not include all Pune orders in both report lines. Use the ten-order workbook before the two appends for the first control.

In a client with HSTACK, put new output headings City, Platform and Sales above a clear grid region. Create a local intermediate name for the result of UNIQUE on both fields. Read its first and second output columns to supply the two corresponding criteria. INDEX with row position 0 returns a whole column within the two-field result for this use. The following formula keeps the two keys together:

=LET(pairList,UNIQUE(tblUnique[[City]:[Platform]]),
     cityKey,INDEX(pairList,0,1),
     platformKey,INDEX(pairList,0,2),
     pairSales,SUMIFS(tblUnique[Amount],tblUnique[City],cityKey,tblUnique[Platform],platformKey),
     HSTACK(pairList,pairSales))

Check every group against its source records

  1. Count the output rows and columns. The original result has seven rows and three columns, with two labels and one amount per row. PairList has two columns and pairSales has one column aligned to it. If your result has only six rows, inspect whether the comparison included both fields.
  2. Check the two groups within Pune. Pune/Blinkit has ₹434 from BLK-1001, BLK-1006 and BLK-1009. Pune/Amazon Now has ₹110 from AMN-1003. Those two lines add up to Pune’s full ₹544.
  3. Check the grouping did not duplicate the city amount. Using City alone as the sum criterion would repeat ₹544 on both Pune lines. Both lines have the same City value but different Platform values. The independent full-source sum would expose the extra amount.
  4. Reconcile the rest of the source. Nashik/Blinkit gives ₹360, Nagpur/Blinkit gives ₹240, Kolhapur/Amazon Now gives ₹232, Solapur/Blinkit gives ₹1,299 and Sambhaji Nagar/Amazon Now gives ₹195. Those lines and the two Pune lines account for the original ₹2,870.

If HSTACK is unavailable, return the distinct two-column result in a clear area and use an adjacent SUMIFS with two criteria for each row. Fill that summary deliberately over the known returned rows or use supported array criteria in a separate output whose shape you can verify. For a clean seven-row source output, check all seven results and compare them with the same amount totals. A formula that worked in another person’s product version may not be available in every workbook client.

Use a frequency measure to annotate a distinct group

A city list with counts already tells you which categories occur only once. In the three adjacent output columns from Lab 1, K2# is the city list and M2# is the aligned count list. In a separate column, use =FILTER(K2#,M2#=1,"No single-appearance cities") to show just the categories with count one. With the ten orders it yields the same four labels as UNIQUE(tblUnique[City],FALSE,TRUE), in the alphabetically sorted order supplied by K2#. This method keeps an explicit no-match fallback for later sources that have no once-only categories. Check that the city spill and count spill come from the same keys before filtering one with the other.

When a single once-only case matters, look at the actual record key. If Pune’s count decreases from four to one after removing test inputs from a scratch source, it could enter the once-only list while the distinct list still contains Pune. The change would reflect the source’s new frequencies. It would not imply that Pune was a new city. A labelled count helps explain why the once-only set can shrink or expand without a change in the number of distinct groups.

Keep a spelling cleanup separate from a valid-label test

The original cleanup flag in the lab answers one question: does the verified transform leave a nonempty label? It does not prove that every nonempty label is an approved city. Imagine a seventh scratch record, EX-07 with Raw City Saturn Street and amount ₹70. TRIM and the replacement rule keep that text because it contains no leading or trailing whitespace to remove. A nonempty cleanup flag would say OK even though Saturn Street may be a delivery route or a value copied into the wrong field.

Decide whether your report should list whatever labels occur or only recognized labels. For a controlled extension make an Approved sheet and put Pune and Nashik in A2:A3. Use an exact known-label check on the cleaned field. In these two example labels there are no wildcard symbols. A Table formula can test membership as follows:

=IF([@[Clean City]]="","Missing",
     IF(COUNTIF(Approved!$A$2:$A$3,[@[Clean City]])>0,"Approved","Review"))

With EX-07 included, the original five approved records still account for ₹650. The missing City on EX-05 accounts for ₹50. The nonempty unapproved label on EX-07 accounts for ₹70. The complete source becomes seven orders at ₹770. Before including the new label in the valid output, ask which real category it should map to. If the practice rule does not yet provide that information, preserve the Review state and keep its amount separate. This is more informative than replacing every unwanted value with an empty cell and losing its original reason.

Check which difference the cleanup can legitimately remove

A leading or trailing ordinary space on a category can be an import artifact. A repeated space inside a full name could deliberately separate parts. Your approved rule might collapse ordinary spaces for cities but retain every character for a receipt identifier. In the original six-row example, the only intended changes are the removal of normal or nonbreaking trailing spaces. You can verify expected lengths and exact outputs before applying the same rule to a larger input. A different business domain may use punctuation, legal names or capital letters that need additional review.

A clean distinct count does not prove records themselves are unique. Two different receipts can legitimately have the same city, platform and amount. If a duplication check is meant to identify repeated receipts, compare the actual Order ID column or a validated compound key. A group summary and a duplicate-record audit serve different purposes and can both be built from the same data. If you do find two identical receipt IDs, inspect whether they reflect an accidental repeated import or two intentional line items sharing a document ID.

Check that a stored label is used as a literal criterion

City names in the practice data do not contain wildcard characters. Some product codes do. A wildcard is a symbol a search treats as a pattern rather than as an ordinary character. When you feed each distinct label into SUMIFS, check whether characters such as asterisk or question mark are supposed to be literal. UNIQUE can list separately stored labels, and a later criterion that interprets one label as a pattern may group too broadly.

Use this small controlled example on a scratch sheet. In A1 type Code and in B1 type Amount. Put R*, R1, R2 and R* in A2:A5, and 30, 40, 50 and 25 in B2:B5. The asterisk in this example is an actual part of the stored business code. Three distinct labels appear. Their correct grouped amounts are 55 for R*, 40 for R1 and 50 for R2. The source total is 145.

  1. Verify the label-only result with =UNIQUE(A2:A5). It should include R*, R1 and R2 once each. This step does not calculate their amounts.
  2. Compare a plain criterion =SUMIFS(B2:B5,A2:A5,"R*"). In SUMIFS that pattern can match every label starting with R. On these four records it gives 145, which is the entire source, not only the two literal R* amounts.
  3. Use an exact text criterion with the asterisk escaped: =SUMIFS(B2:B5,A2:A5,"=R~*"). Tilde makes the following asterisk literal. Now the result is 55. Verify the two matching rows actually contain the R* label.
  4. Check the other two groups independently. Their totals, 40 and 50, add to the literal R* result for 145. If you used the pattern for the first group, the three reported group amounts would total 235, which would be larger than the original source.

When a report receives external labels that can include wildcard characters, decide how to escape them, or use a comparison method suited to exact approved keys. A question mark also has a pattern meaning in appropriate criteria. Audit one stored label with a wildcard character and one label that the overly broad pattern would match. In the course workbook the original city names are plain labels. The special-code test exists to explain why a correct distinct list does not by itself guarantee a correct grouped sum.

Reconcile the complete source after changing the summary

Use a stable grouping key and a separate display label

A business can have two branches called Main Store. The name is what a reader recognizes, but a branch ID identifies the exact location. UNIQUE on the display name would produce one choice, even though two distinct branches need their own report lines. Use the actual branch IDs or compare Region and Store together, then retrieve the display name you want to show. Keep the grouping key in or next to the output when a reviewer must trace a line back to original records.

Test that choice with a small pair of intentionally repeated labels. Suppose Branch 11 has order amounts 20 and 40, and Branch 22 has one order at 70. If all three records have the label Main Store, a name-only summary gives 130 on one row. ID-based comparison gives two lines at 60 and 70. The source sums agree either way. The correct report depends on which categories the reader wanted to distinguish. Add a separate count so someone can see the first branch has two receipts and the second has just one.

Identify why source membership changed instead of relying on the latest count

If a city is missing from a new summary, first check whether any source record still carries that city in the intended field. Then check whether the new report intentionally filtered out an invalid category or used once-only mode. For example, appending another Nashik order does not reduce the distinct set, and Nashik is already outside the once-only set. Appending a second Solapur order would remove Solapur from the once-only set while keeping it distinct. Write what changed in the source and then what changed in the output.

To verify an exact pair report over successive weeks, keep the original city/platform input scheme and compare a known subtotal after each import. When a platform label changes due to an approved rename, the old and new labels can appear as separate groups unless you use an intentional mapping. Keep both the raw source and the approved label field so the reason for a change is traceable. A distinct summary can accurately reflect every stored label and still fail to reflect the intended business grouping.

Use one changed record to test the shape without changing the sums unexpectedly

In a scratch copy of the ten original orders, change AMN-1003’s Platform from Amazon Now to Blinkit while leaving its amount and city intact. The City grouping is unchanged. Pune still contains four orders worth ₹544. The distinct Pune/Amazon Now pair disappears because it had one supporting row. Pune/Blinkit now represents all four Pune orders and gives the same ₹544 on one pair line. The pair result shrinks from seven rows to six. The source total stays at ₹2,870. This isolates a grouping-key change from an amount or membership change.

After the change, inspect the once-only pairs too. The original five such pairs lose one, Pune/Amazon Now. The relative position of other visible report rows can change as a list shrinks. Record the original and changed IDs on an independent check tab instead of assuming that a specific worksheet row must always display the same city. Restore the original Platform in your scratch input and check that the original two Pune lines return. Their two subtotals should account for all four original Pune amounts without changing the full-source reconciliation.

Keep an independent downstream note to make the summary reviewable

For each version write down the number of detail rows, distinct groups and rejected or missing group keys. Record any confirmation of duplicate IDs separately from repeated city labels. In the original clean city fixture there are ten order records and six cities. In the messy fixture there are six order records, two verified labels after the planned cleanup and one missing City record. A screenshot of the two labels would not communicate which amounts or orders were out of scope. Report the dimensions and an independent reconciliation before sharing the result.

Follow changes to the city and pair lists

  1. Read ten order records

    Six different cities and seven different city/platform pairs are represented. The order count remains ten.

  2. Choose an exactly-once result

    Pune and Nashik drop out of the city result because both repeat. Four other cities occur once.

  3. Add an order from a new city

    Satara adds one distinct city and one distinct city/platform pair. Its amount also enters the appropriate city summary.

  4. Repeat an existing pair

    The new Pune/Amazon Now order increases its count and amount. The pair remains distinct and is no longer eligible for once-only.

Check the grouping key before reporting a number

  • The list gets longer than expected. Inspect the raw labels and stored types. Check spaces and accidental category variants. Preserve the raw column and group by a verified cleanup field where appropriate.
  • A city disappeared. Check the exactly_once argument. It removes any category that appears more than once in the input. Compare the category’s frequency on the full source.
  • Two groups with different amounts look like duplicates. Confirm what you intend to compare. City and Platform treated as one pair produce a different number of groups than City alone.
  • Grand total is wrong. Verify each summary amount reads the same list of city criteria. Look for missing records, text amounts, different field names or an invalid spill. Compare group counts and amounts independently.
  • New source city is absent. Check actual Table membership and whether its name is still a variant. A repeated existing label will increase an order count without increasing the number of distinct labels.
  • The output cannot expand. Move the note or formula that overlaps the intended new rows. Make a clear ordinary-grid area for the result and its summary fields.

Quiz. Choose the intended comparison

How many distinct cities are in the ten-order source?

Six. Pune and Nashik each appear once in the distinct list despite repeating in the original order source.

How many cities appear exactly once?

Four: Nagpur, Kolhapur, Solapur and Sambhaji Nagar. Pune and Nashik fail the once-only requirement because they have more than one order.

Why are there seven City and Platform pairs but six cities?

Pune has two platforms, so it contributes two different pairs. One row per city reduces those to one for the single-field comparison.

What happens when you append another Pune/Amazon Now order?

The existing distinct pair remains one row. Its frequency becomes two, excluding it from the once-only pair result. The added amount is included in Pune’s summary.

What is the purpose of the Data Status field?

It identifies which source records have no usable city label after the planned cleanup. EX-05 is missing a city and its ₹50 must be reconciled separately from approved city amounts.

Which argument would make UNIQUE compare the three columns in the horizontal example?

Set by_col to TRUE. Columns A and B then share the same numeric pair, while C has a different pair. With regular distinct mode, two columns are returned.

Interview practice. Explain the grouping workflow

Why use UNIQUE instead of deleting duplicate source rows?

UNIQUE builds a separate set of categories. Four different Pune receipts are four records and their amounts all belong to the summary. Deleting rows because their city repeats would lose valid order facts.

How do you distinguish one-time groups from repeat groups?

Use the same grouping field and test its observation count. exactly_once TRUE focuses on groups where that count is one. Check a repeated category such as Pune to prove it is excluded even though it belongs in the distinct list.

How do you validate a city-by-sales report?

Check exact city labels and their expected counts, verify one city’s source amounts and compare the sum across all cities with the original source total. If labels are missing, account separately for the missing amount.

Why might an imported label that looks identical appear twice?

Leading and trailing spaces, a nonbreaking space or another stored character can distinguish the text. Inspect the lengths and characters first. Clean only the category field whose intended naming rule has been verified.

How would you keep a summary sorted by sales without misaligning orders?

Calculate all amount and order-count columns from the same city list, combine the aligned report columns and then sort complete summary rows by their sale totals with a city tiebreaker. Do not sort a numeric column by itself next to a separate category list.

Revision cards

  • Distinct. Keep one representative of every group, including repeated groups.
  • Exactly once. Keep only groups that have a frequency of one.
  • Compare directions. Default comparison is across source rows; choose TRUE for column vectors.
  • Pair. Include both City and Platform if their combination defines the group.
  • Dynamic summary. Use the live category list as the criteria for aligned amounts and counts.
  • Data quality. Keep original labels, validate cleaned categories and reconcile missing records.

Microsoft references

Continue practising: explore the existing Excel Task Hub for additional exercises.