Token replace between two files with dynamic refresh

MrSamExcel

Board Regular
Joined
Apr 6, 2016
Messages
51
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Text Result v1.xlsx contains text strings with [tokens] that need to be replaced with values from a separate file called Stats Token v2.xlsx. I want the tokens to update with values from the latest modified version of Stats Token that resides in the same folder as Text Result on my computer. For example, today Text Result v1 and Stats Token v2 are saved to my Desktop. Tomorrow, I change a STAT_VALUE in Stats Token v2 from 99 to 98 and save to my Desktop as Stats Token v3. Now when I open Text Result v1, the value in B2 should display “I got 98 problems” instead of 99. How can I set this up? Appreciate any suggestions.

The file names will be static before the version number "Text Result" and "Stats Token", but the version number needs to change every time there’s an update, such as v1 to v2. I have some flexibility with Stats Token file, could add helper columns for example. Users can’t use VBA.

Text Result v1.xlsx
ABC
1Text IDTextResult that should display in "Text" field after auto-pull variable from 'Stats Token*.xlsx'
2paragraph1I got [STAT ID 1 DISPLAY] and this is one.I got 99 problems and this is one.
3paragraph2This month I'll eat [STAT ID 2 STAT_VALUE] [STAT ID 2 STAT_LABEL].This month I'll eat 100 apple pies.
Text


Stats Token v1.xlsx
ABCDEF
1FILE_IDSTAT_IDAS_OF_DATESTAT_VALUESTAT_LABELDISPLAY
2FILE1STAT ID 16/30/202499problems99 problems
3FILE1STAT ID 29/30/2024100apple pies
4FILE1STAT ID 39/30/2024500miles
Stats
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi Sam,
for that you'd need an INDIRECT formula to build up the reference in your formula. See e.g. this explainer: Dynamic workbook reference So you'd need some place in your Text Result workbook where you define the name of your input file (so a cell with e.g. "file1.xlsx" or "file2.xlsx") and use that to build up your formulas.
Hope that works,
Koen
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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