Forum Discussion
Jn12345
Sep 23, 2024Brass Contributor
Filter Function to be optional depending on blank and non blank values
Hello, I've tried a ton of different functions and it seems that I simply have to make a huge nested IF function for this but I will see if any of you smart excel folk have any answers first. ...
joelb95
Sep 24, 2024Brass Contributor
I spent way more time on this than I should have, but I think there isn't a great answer due to validation limitations. My final suggestion to you is in some ways a poor second to one that PeterBartholomew1 appears to have come up with involving using the cell() formula to return the address of the last active cell for purposes of setting your filters and generating your validation arrays. What I would have done is created a helper column that requires you to check the row that you want to validate in order to update your filter arrays.
In any event, here is a file that has some of what I tried for you. You could, theoretically, adapt my formulas to your purpose relatively easily and expand them as necessary.
validation_filter=lambda(
choice, equip_val, make_val, model_val, serial_val,
=LET(
equip_col, tbl_equipment_list[Equipment Type],
make_col, tbl_equipment_list[Make],
model_col, tbl_equipment_list[Model],
serial_col, tbl_equipment_list[Serial Number],
mask_func, LAMBDA(value, column,
IF(ISBLANK(value), EXPAND(TRUE, ROWS(column), 1, TRUE), value = column)
),
equip_mask, mask_func(equip_val, equip_col),
make_mask, mask_func(make_val, make_col),
model_mask, mask_func(model_val, model_col),
serial_mask, mask_func(serial_val, serial_col),
combined_mask, equip_mask * make_mask * model_mask * serial_mask,
no_box_checked, IFERROR(
AND(NOT(equip_val), NOT(make_val), NOT(model_val), NOT(serial_val)),
FALSE
),
equip_choices, UNIQUE(FILTER(equip_col, combined_mask, "")),
make_choices, UNIQUE(FILTER(make_col, combined_mask, "")),
model_choices, UNIQUE(FILTER(model_col, combined_mask, "")),
serial_choices, UNIQUE(FILTER(serial_col, combined_mask, "")),
pick_choice_list, LAMBDA(choice,
CHOOSE(choice, equip_choices, make_choices, model_choices, serial_choices)
),
return_all, LAMBDA(choice, CHOOSE(choice, equip_col, make_col, model_col, serial_col)),
result, IF(no_box_checked, return_all(choice), pick_choice_list(choice)),
result
))
valid_makes=XLOOKUP("x", tbl_results[filter_row], tbl_results[make], FALSE)
valid_model=XLOOKUP("x", tbl_results[filter_row], tbl_results[model], FALSE)
valid_serial_numbers=XLOOKUP("x", tbl_results[filter_row], tbl_results[serial_number], FALSE)
valid_types=XLOOKUP("x", tbl_results[filter_row], tbl_results[type], FALSE)
- Jn12345Oct 03, 2024Brass ContributorLegend, Thank you! I wasn't able to do everything I wanted but this definitely set me in the right direction! thank you a ton.