Forum Discussion
magnus_b
6 years agoAdvocate II
Duplicate last column
Hi, I have a source file with a dynamic number of columns, e.g.: Year, Month, Budget revision 1, Budget revision 2, Budget revision 3... I want to create a column called "Latest budget", tha...
amitchandak
6 years agoSuper User
magnus_b ,Can you share sample data and sample output in table format?
- magnus_b6 years agoAdvocate II
amitchandak See sample input and output below. The tricky part here is that the number of "Budget revision X" columns can vary, and the function needs to always duplicate the right-most column.
Sample input 1:Year Month Budget revision 1 Budget revision 2 2020 1 903920 1008930 2020 2 239450 345481 2020 3 802380 802389 2020 4 239509 299900
Sample output 1:Year Month Budget revision 1 Budget revision 2 Last budget 2020 1 903920 1008930 1008930 2020 2 239450 345481 345481 2020 3 802380 802389 802389 2020 4 239509 299900 299900
Sample input 2:Year Month Budget revision 1 Budget revision 2 Budget revision 3 2020 1 903920 1008930 901512 2020 2 239450 345481 437457 2020 3 802380 802389 568852 2020 4 239509 299900 345634
Sample output 2:Year Month Budget revision 1 Budget revision 2 Budget revision 3 Last budget 2020 1 903920 1008930 901512 901512 2020 2 239450 345481 437457 437457 2020 3 802380 802389 568852 568852 2020 4 239509 299900 345634 345634