I’m working on a spreadsheet and I’m stuck with a formula. I need column I to show the age group I picked in the second row of column C for each race. My current formula works for most ages, but it’s not handling the ‘LIT’ group in Race 5 (row 68).
The formula also needs to work for ‘All Star’ races, like the one in row 243.
Have you considered using a SWITCH function instead? It might simplify your formula and make it easier to handle special cases like ‘LIT’ and ‘All Star’. Here’s a basic structure:
This approach allows you to define multiple conditions and their corresponding outputs. It’s more readable and maintainable in the long run. You might need to adjust the regex patterns to fit your exact data structure, but this should give you a good starting point.
I’ve encountered similar issues when working with age group calculations in Excel. In my experience the key is to modify your REGEXMATCH and REGEXEXTRACT functions to account for non-numeric age groups like ‘LIT’ and ‘All Star’.
One approach is to add a separate condition in your IF statement so that when the formula detects ‘LIT’ or ‘All Star’, it extracts these values directly. This could be implemented with a nested IF: first check for these special cases and then fall back on your existing numeric solution using vlookup and the regex functions.
You may need to fine-tune the regex patterns to align with your data structure, but this method should allow you to handle both numeric and non-numeric age groups consistently.