Forum Discussion
264 nested IF statements -- alternative?
- Jun 06, 2025
OK. I've modified your data.xlsx to make, I trust, how to do this clear. Here's the basic Input and Output area
I usually follow a convention of using yellow background in any cell that calls for entry by the user, and have followed that convention here. Other than the "Raw Score" cell, I've also used Data Validation to ensure that only acceptable values are entered. In the two cases, there are only two choices of appropriate text. In the others, a whole number is required, within the acceptable range.
Then, in the gray areas, the calculations are done, in both cases using INDEX and MATCH. The tables for those retrievals are on a separate "Behind the Scenes" tab. It looks like this:
There are formulas in the column of four category identifiers. And a final formula in the gray background area, where the column heading is calculated, simply by concatenating the strings above. I do this in the simplest way, using the "&" symbol. It could be done other ways, but really not necessary here. I also should note that some folks would combine all these formulas into a single one; that's entirely possible, but for your sake in understanding all the steps, I've chosen to break it into separate steps.
I also did not take the trouble to verify all the outputs when changing the inputs on that primary screen. You should do that.
Let me know if you have questions.
In the attached I've created a single table, as I suggested was possible based on the image you've shared. I then create a column heading that captures the salient demographic data, which is then used in an INDEX and MATCH formula to find the corresponding T-score that applies to a person of the selected gender, age group, education level........
It's all in the design.
If you are able to share your full set of tables, I'd be happy to show how you could extend this approach further. Basic point: there is absolutely no need to multiple IFs and VLOOKUPs for different tables. You can do this with a single table.
- getcracken801Jun 05, 2025Copper Contributor
Thank you for you explanation. I've spent some time learning about INDEX MATCH MATCH and have a better understanding of how that could be used for this. I'm now stuck on how to create a value for the MATCH (columns) part of the formula (what you have highlighted in yellow). I went ahead and changed my table to using your approach (single table with column headings for each demographic combination). Really appreciate your help and recommendations!
- mathetesJun 06, 2025Gold Contributor
OK. I've modified your data.xlsx to make, I trust, how to do this clear. Here's the basic Input and Output area
I usually follow a convention of using yellow background in any cell that calls for entry by the user, and have followed that convention here. Other than the "Raw Score" cell, I've also used Data Validation to ensure that only acceptable values are entered. In the two cases, there are only two choices of appropriate text. In the others, a whole number is required, within the acceptable range.
Then, in the gray areas, the calculations are done, in both cases using INDEX and MATCH. The tables for those retrievals are on a separate "Behind the Scenes" tab. It looks like this:
There are formulas in the column of four category identifiers. And a final formula in the gray background area, where the column heading is calculated, simply by concatenating the strings above. I do this in the simplest way, using the "&" symbol. It could be done other ways, but really not necessary here. I also should note that some folks would combine all these formulas into a single one; that's entirely possible, but for your sake in understanding all the steps, I've chosen to break it into separate steps.
I also did not take the trouble to verify all the outputs when changing the inputs on that primary screen. You should do that.
Let me know if you have questions.
- getcracken801Jun 10, 2025Copper Contributor
Thank you so much for all of this! I went over all the of the formulas and I can clearly see how the INDEX MATCH formula works here. This is incredibly useful.