How to Add a Decimal Based on Another Field in Microsoft Access
Question details
The user needs to convert imported text values into numbers and dynamically insert a decimal point based on the value found in another field.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Formatting imported data where numeric strings and their corresponding decimal-position indicators are stored in separate fields.
- Observed behavior
- The data currently exists as a plain text string and a separate decimal position number, and needs to be combined into a properly formatted numeric decimal field.
Ensure you have a recent backup of your Access database before running any update queries, as they will permanently modify the data in your tables.
Use an Update Query with a Power of Ten Formula
Create a new numeric field and populate it using an update query that divides the text field by 10 raised to the power of the decimal-position field.
When importing data where numbers and decimal placements are stored separately, you can mathematically construct the correct decimal by using the expression: FirstField / (10 ^ SecondField).
For example, a text value of 1705 with a decimal position value of 2 will be processed as 1705 / 100, which successfully returns 17.05.
Open your table in Design View and add a new column to store the final result. Set the Data Type to 'Number' and the Field Size to 'Double' or 'Decimal' to ensure it can hold decimal values.
Navigate to the 'Create' tab on the ribbon and click 'Query Design'. Select the table containing your imported data to add it to the query workspace.
In the Query Setup group on the ribbon, click 'Update' to change the query type from a Select Query to an Update Query.
Drag your newly created numeric field into the query grid. In the 'Update To' row, enter the formula: CDbl([YourTextField]) / (10 ^ [DecimalPositionField]). Ensure you replace the field names with your actual column names.
Click the 'Run' button (red exclamation mark) in the Results group to execute the query. Confirm the prompt to update the rows and check your table to see the correctly formatted decimals.

Need a Free Office Suite? Try WPS Office
While Microsoft Access is a paid database application, you can handle most data manipulation, text-to-number conversions, and reporting for free using WPS Spreadsheet. It is a lightweight, highly compatible alternative to Microsoft Office.

Frequently Asked Questions
Can I use the CDbl function in an Access Select Query without altering my table?
Yes, you can use the CDbl function and the division formula directly in a standard Select Query. This will calculate and display the converted numbers dynamically without permanently updating or modifying your source table.
What happens if the text field contains non-numeric characters?
If the text field contains letters or special symbols, the CDbl function will fail to evaluate it as a number and will return an error (such as #Error) during query execution. Ensure your data is cleaned of non-numeric characters before running the query.
How do I add a fixed number of decimal places to all records instead of using a second field?
If every record requires the exact same decimal placement (for example, two decimal places), you do not need a second field. You can simply use a fixed formula in your update query like CDbl([YourTextField]) / 100.




