Merge Data in One Column from One Data Sheet with Another

treym

Board Regular
Joined
Feb 20, 2004
Messages
121
Office Version
  1. 365
Platform
  1. Windows
I am VERY new to Access. I have managed to pull in 2 different Excel spreadsheets and can run a query combining the information need from between the two. However I have a column named the same in both with different sales numbers. So let's just call it Sales. When I query them I get 2 distinct columns of "Sales". How to I get it so those merge into one? Things are linked via an account number so to speak. So one might say $10 in "Sales" from worksheet 1, while the other might say $5. I'd like just one column that says $15. Is that possible?
Many Thanks,
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Yes, you just do a calculated field in a query that adds those two sales fields together. I would do it like this:
Code:
TotalSales: Nz([Sheet1].[Sales],0) + Nz([Sheet2].[Sales],0)
What the NZ function does is convert any blanks or nulls to zero, so if you have any nulls or unmatched values, it will still do the math without errors.

If you have any issues incorporating this, go into the query that you currently have that lists both sales fields, change to SQL View, and copy and paste the SQL code here. And then we can help you edit the code.
 
Upvote 0
Thanks, lets see if I completed this correctly. This is the code I modified: TotalUnsaleableCredits: Nz([COGNOS DATA].[Unsaleable Returns Total] AS [COGNOS DATA_Unsaleable Returns Total],0) + Nz([WMtgtSAMSrawData].[WMtgtSAMSrawData_Unsaleable Returns Total],0) ...but I'm sure I've done something wrong as I get an error that states "Characters found after end of SQL statement." I assume I replaced "Sheet 1" and "Sheet 2" with the actual table names?
 
Upvote 0
Just use:
Code:
[COLOR=#333333]TotalUnsaleableCredits: Nz([COGNOS DATA].[Unsaleable Returns Total],0) + Nz([WMtgtSAMSrawData].[WMtgtSAMSrawData_Unsaleable Returns Total],0)[/COLOR]
the " AS [COGNOS DATA_Unsaleable Returns Total]" part should not be in the middle of your equation.

If you aren't sure how to add calculated fields in an Access query, have a look here: [/COLOR]http://www.gcflearnfree.org/access2013/creating-calculated-fields-and-totals-rows/1/
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top