Nov 14 2023 06:58 PM - edited Nov 14 2023 07:10 PM
Hello and thank you in advance.
I want to know if is possible to change the part of the formula highlighted here so that instead of Table1[Validation] (which i chose for the example) the column that is in the formula changes based on the U4 column selection. I have 0 experience with macros and VBA, so i apologize in advance if not possible.
Nov 14 2023 09:30 PM
SolutionIt looks like you're trying to create a dynamic formula that references a column based on the selection in cell U4. In Excel formulas alone (without VBA or macros), you can achieve this using the INDIRECT function. However, keep in mind that the INDIRECT function is volatile, meaning it can impact performance, especially in large datasets.
Here's a basic example of how you might modify your formula (i can not see your picture correctly on my pc):
Assuming your current formula is something like:
=SUMIFS(Table1[Validation], Table1[Category], U4)
You can make it dynamic based on the value in U4 using INDIRECT:
=SUMIFS(INDIRECT("Table1[" & U4 & "]"), Table1[Category], U4)
This assumes that the value in U4 matches the column header in Table1. The INDIRECT function is used to dynamically reference the column based on the value in U4.
However, note that this approach has some limitations and potential issues:
If you're interested in a VBA solution, let me know, and I can provide some guidance on how to achieve this with a simple macro. The text was revised with the AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.
Nov 15 2023 05:08 AM
Nov 15 2023 05:34 AM
@GeisonGDC Another option is to use the XLOOKUP function to return the desired table column based on the value in cell U4. For example:
=XLOOKUP(U4, Table1[#Headers], Table1)
In the formula above, the lookup_value is cell U4, the lookup_array is the header row of Table1, and the return_array is Table1 (the entire data range). If the value in cell U4 matches with one of the table headers, the entire corresponding column is returned.
This method can then be combined with the FILTER function to return only the records where the selected column matches the value in cell Y4:
=FILTER(Table1[[name]:[Contact ID]], XLOOKUP(U4, Table1[#Headers], Table1)=Y4, "No records found")
Nov 14 2023 09:30 PM
SolutionIt looks like you're trying to create a dynamic formula that references a column based on the selection in cell U4. In Excel formulas alone (without VBA or macros), you can achieve this using the INDIRECT function. However, keep in mind that the INDIRECT function is volatile, meaning it can impact performance, especially in large datasets.
Here's a basic example of how you might modify your formula (i can not see your picture correctly on my pc):
Assuming your current formula is something like:
=SUMIFS(Table1[Validation], Table1[Category], U4)
You can make it dynamic based on the value in U4 using INDIRECT:
=SUMIFS(INDIRECT("Table1[" & U4 & "]"), Table1[Category], U4)
This assumes that the value in U4 matches the column header in Table1. The INDIRECT function is used to dynamically reference the column based on the value in U4.
However, note that this approach has some limitations and potential issues:
If you're interested in a VBA solution, let me know, and I can provide some guidance on how to achieve this with a simple macro. The text was revised with the AI.
My answers are voluntary and without guarantee!
Hope this will help you.
Was the answer useful? Mark as best response and like it!
This will help all forum participants.