Adding formula to custom column ...

adambc

Active Member
Joined
Jan 13, 2020
Messages
412
Office Version
  1. 365
Platform
  1. Windows
I have two source files which are updated daily ...

I have created Connections to them, then used Combine Queries/Append to create a combined table with a Custom Column ...

I want to populate the Custom Column with a value depending on which file the record came from ie "Source1" if record comes from the first file, "Source2" if the record comes from the second file ...

Can anyone help me please?

Thanks ...
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Add a column source or file name of whatever to each of the queries and hardcode the value.
 
Upvote 0
UPDATE ...

Pseudo Excel statement ...

=IF({SourceFilename} = "Source1.xlsx", "Source1", IF({SourceFilename} = "Source2.xlsx", "Source2", ""))

Two questions ...

1. how do I write this in PQ

2. what do I use instead of {SourceFilename}

Thanks ...
 
Upvote 0
Add a column source or file name of whatever to each of the queries and hardcode the value.
Thank you for your reply, but I don’t know how?

Can you give me some guidance please?

Thanks …
 
Upvote 0
You say you have 2 queries. Inside each you click Add Custom Column. That opens a formula screen. Simply type "SourceName". This is the name you want tot to give. And remember to name the column in the same screen.
 
Upvote 0
Solution
You say you have 2 queries. Inside each you click Add Custom Column. That opens a formula screen. Simply type "SourceName". This is the name you want tot to give. And remember to name the column in the same screen.
Perfect, thanks ...
 
Upvote 0

Forum statistics

Threads
1,223,322
Messages
6,171,449
Members
452,404
Latest member
vivek562

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