Others

How to Calculate SGST, CGST, and IGST in an Access Subform

Aamir Naveed AkramAamir Naveed Akram Nov 2, 2026 869 views

Question details

The user needs a method to dynamically calculate SGST, CGST, and IGST within an Access subform based on the customer's state and individual product GST rates.

How to Calculate SGST, CGST, and IGST in an Access Subform
Product
Microsoft Access
Device & OS
not provided
Scenario
Building an order and billing database where tax must be accurately computed on a per-product line item basis rather than on the total sale.
Observed behavior
The database needs to split the tax into SGST and CGST for local sales, or combine it into IGST for interstate sales, applying these rules dynamically at the subform level.
Before you start

Ensure your Customer table includes a State or Region field to accurately determine the sale type, and your Product table includes a specific GST percentage field for each individual item.

Solution 1Recommended

Configure Dynamic Calculations in the Bill Details Subform

Use conditional expressions in your subform query to evaluate the sale type per transaction and calculate the correct tax values based on the product's assigned tax rate.

To handle dynamic GST calculations correctly, you must evaluate the sale type for each specific transaction line. Because GST rates vary across different products (e.g., 5%, 12%, 18%), calculating it strictly at the total bill level is often inaccurate.

Local sales require the product's GST rate to be divided equally into SGST and CGST. Interstate sales require the full GST rate to be applied entirely to IGST.

1
Retrieve Product and Customer Data

Set up the Record Source query for your subform. Ensure it joins the Products table (to fetch the [GSTRate]) and references the Customers table or main form (to determine [CustomerState]).

2
Create the SGST Calculation

In the query design grid or a calculated text box on the subform, use an IIF statement to assign half the tax to SGST for local sales: IIf([CustomerState]=[LocalState], ([Amount]*[GSTRate])/2, 0).

3
Create the CGST Calculation

Similarly, configure the CGST field using the exact same logic for the remaining half of the tax: IIf([CustomerState]=[LocalState], ([Amount]*[GSTRate])/2, 0).

4
Create the IGST Calculation

For interstate sales, apply the full tax rate to IGST by returning zero if it is a local sale, and the full rate if it is not: IIf([CustomerState]<>[LocalState], [Amount]*[GSTRate], 0).

Configure Dynamic Calculations in the Bill Details Subform
Preserve Historical Tax Rates: Tax rates can change over time. It is a best practice to copy and store the calculated tax amount or the applied percentage directly in the BillDetails table when the record is created, rather than just referencing the live Product table.
Free Microsoft Office alternative

Simplify Your Billing and Tax Calculations with WPS Spreadsheet

Microsoft Access can be overly complex and difficult to maintain for simple billing and invoicing solutions. WPS Spreadsheet offers a highly compatible, free, and lightweight alternative. You can easily create automated GST invoice templates using familiar formulas like IF and VLOOKUP, ensuring seamless calculation of SGST, CGST, and IGST without the overhead of maintaining a relational database.

Free and lightweight office suite with no complex database design required.Fully compatible with Microsoft Excel (.xlsx) formats for easy migration and sharing.Use simple IF and VLOOKUP formulas to automate SGST, CGST, and IGST calculations on your invoices.Familiar user interface makes it easy for anyone to create, manage, and print professional bills.
microsoft office alternative - wps office

Frequently Asked Questions

Why should tax be calculated on the subform per product line instead of the total bill?

Because different products often have varying GST rates (e.g., 5%, 12%, 18%). Calculating the tax at the subform line level ensures the correct specific rate is applied to each item before summarizing the total bill.

How do I handle historical invoice data if GST rates change in the future?

Instead of directly calculating the tax in the subform by continually referencing the Product table's current rate, use an Update Query or VBA to copy the product's GST rate into a static 'AppliedTaxRate' field in your BillDetails table at the exact time of purchase.

Can I use VBA instead of calculated query fields for GST in Access?

Yes. You can use the AfterUpdate event of the Product selection combo box on your subform to retrieve the GST rate, check the customer's state, and populate the SGST, CGST, and IGST bound text boxes programmatically.