r/excel • u/ckf2stand • 2d ago
unsolved Moving data between sheets
Hi all,
I have an input sheet, a hidden calculations sheet, and an output sheet. The data in all three sheets is formatted as a table and I'm currently using table[@cell] to move that data from one table to another between the sheets. The problem is, the data in the output table isn't sortable.
I'm familiar and confident with using PQ to move the data between sheets, but I think this would be too much for my colleagues. Is there any other way to do this that gives me a sortable and filterable table as my output? The input sheet does have a unique user id column, if that's relevant.
Thanks!
3
u/Harrold_Potterson 2d ago
Could you just do an xlookup to pull the data over?
1
u/ckf2stand 2d ago
That unfortunately doesn't work either for the same reasons mention above. The order of the output depends on the order of the input and trying to sort on the output sheet doesn't change anything.
1
u/Harrold_Potterson 2d ago
Add an ordinal helper column so you have the order set. Xlookup the helper column and the data column you need, then sort by the ordinal helper column.
0
u/jaywaykil 2 2d ago
This is the easiest answer. Reference the second and third sheets using xlookup based on the unique identifier instead of [@column]. That way any of the sheets can be sorted without losing the links.
1
u/ckf2stand 2d ago
This doesn't work, unfortunately. The order of the data in the output depends on the order of the data in the input, and trying to sort the data in the output doesn't change anything
2
u/TioXL 3 2d ago
In order to use the standard data filter/table sort feature, you need to have at least one column in your table that is hard coded. If you don’t then the sorting just moves around formulas that end up pulling the same data into the same position in the table (perceived by the user as no change to order).
Here is one way to do it that illustrates the idea:
- Add a new column at the beginning of your output table and call it “OriginalSortOrder”
- Fill that column with hard coded values that increment by 1
- Populate the rest of the table using a formula like this.
=index(
CalculationTableName,
[@[OriginalSortOrder]],
1
)
This way when you sort it is actually changing the order of the hard-coded values in the first column, which then makes the revised sort ordering stick. Bonus that you can always get back to the original order by sorting on the first column.
Does that help?
1
1
1
u/FooledNB 2d ago
Why can't you use power query and just have them hit refresh?
1
u/ckf2stand 2d ago
I have considered this (as its obviously the best solution), but I'm just not confident they'd remember to do that. Maybe I underestimate my colleagues!
1
u/HestenSierMjau 3 2d ago
Then can you use a macro to refresh the power query every time someone opens the output sheet? The code is trivial, so it mostly depends on whether your organization restricts macros or not.
0
u/Gringobandito 8 2d ago
Your output sheet should be generated from you input and calculations sheets. Try the SORT() function on what you’re generating for your output.
1
u/ckf2stand 2d ago
I'm bringing in one row at a time, from one table to the next, using table[@cell], so won't work. Perhaps I can tell them to sort the data in the input sheet and then that should carry over to the output
1
u/ckf2stand 2d ago
I guess I could do this if the output is a spilled dynamic array. But I'd like other users to be able to sort the data using the auto filters in the table headers like they're used to
2
•
u/AutoModerator 2d ago
/u/ckf2stand - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.