How to Design Tables for Multiple Records with the Same Key
Question details
The user needs to structure a table or database to store multiple sets of related records where several individual records share a unique key. They also need to incorporate three currency fields and calculate a combined total for each group.
- Product
- Spreadsheet / Database
- Device & OS
- not provided
- Scenario
- Designing a data model to efficiently handle grouped records with shared keys and aggregate currency totals without duplicating parent data.
- Observed behavior
- The user is looking to correctly establish a parent-child data structure to track grouped records and sum up corresponding dollar amounts.
Before modifying your data structure, identify the primary identifier for your main groups and list all the fields (like currency amounts) that need to be recorded for each individual entry.
Implement a Parent-Child Table Relationship
The best practice for storing multiple records that share a key is to separate the data into a parent table for the group attributes and a child table for the individual records.
By utilizing a relational model, you avoid duplicating the shared information. The parent table holds the unique group identifier, while the child table stores the individual transactions linked back to the parent.
Define a primary key (e.g., GroupID) to serve as the unique identifier for each set of records, storing any details that apply to the group as a whole.
Add an AutoNumber ID as the primary key for the child table to ensure each record is unique. Then, include a foreign key column that matches the Parent Table's GroupID.
In the child table, insert the three required currency fields where the individual financial values for each record will be stored.
Use a query or reporting tool to group the data by the shared GroupID and SUM the currency fields across all related child records to get the combined total.
Use a Flat Table with SUMIF Functions in a Spreadsheet
If you are managing this data within a spreadsheet software rather than a relational database, you can use a flat table combined with aggregation formulas.
Organize and Calculate Grouped Records with WPS Spreadsheet
While relational databases require complex table modeling, WPS Spreadsheet allows you to easily manage records with shared keys using PivotTables and SUMIF formulas to automatically calculate combined currency totals in a familiar interface.
- 1. Organize Your Data: Open WPS Spreadsheet and organize your tabular data with a 'Shared Key' column alongside your three currency fields.
- 2. Insert a PivotTable: Select your entire data range, navigate to the 'Insert' tab on the top ribbon, and click 'PivotTable'.
- 3. Configure the PivotTable: Drag the 'Shared Key' field into the Rows area, and drag the currency fields into the Values area. WPS Spreadsheet will automatically sum the values and display the combined total for each shared key.

Frequently Asked Questions
What is an AutoNumber ID and why do I need it for the child table?
An AutoNumber ID automatically generates a unique identifier for every single row in your child table. Even if multiple records share the same group key, each record still requires its own unique primary key to maintain data integrity and allow for individual updates.
How do I update all records with the same key at once?
In a relational database, you can execute an Update Query filtered by the shared key to modify all related child records simultaneously. In a spreadsheet program, you can apply a Filter to the 'Shared Key' column and paste the updated values across the visible rows.
Can I combine the parent and child tables into one flat table?
Yes, you can place all data into a single flat table, which is common in spreadsheet applications. However, this often leads to redundant data entry and increases the risk of errors. Using a parent-child relationship is the standard database approach for one-to-many data modeling.




