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.
First of all, although you may indeed currently have 264 separate tables, it looks (and I'll acknowledge maybe I'm missing something crucial) ...it looks as if all those you show in that image could in fact be combined into a more complex--yes!--single table. They all have exactly the same first column, for starters. So the second column could be headed with some short title that refers to the unique demographic characteristic you have designating the table....make that (in some shortened form) a column heading. The data IN the column would still be the T-score for that segment of the population that falls in the appropriate row. In fact, I'll go out on a limb and speculate that all of the other 240-odd tables may be similarly arranged, some referring to females of varying age cohorts, etc.......that all 264 current tables could be made into a single table. Again, maybe I'm missing something, but I'm certain that could be done with what you've shown.
If you were to do that change, you could use INDEX and MATCH to retrieve the desired result.
By the way, an image is at best moderately helpful. You could help us help you a lot more by posting the actual workbook.