Forum Discussion
What is the order of operations for nested IF & AND statements over a range of cells
- May 05, 2024
=IFERROR(INDEX($B$2:$K$2,SMALL(IF(($B$4:$K$4=0)*($B$6:$K$6<>0),COLUMN($B:$K)-1),ROW($A1))),"")
This formula could be an alternative and it returns the categories in cell E9 and below in my sample file. The formula must be entered as an arrayformula with ctrl+shift+enter if someone doesn't work with Office 365 or Excel for the web or Excel 2021.
=IFERROR(INDEX($B$2:$K$2,SMALL(IF(($B$4:$K$4=0)*($B$6:$K$6<>0),COLUMN($B:$K)-1),ROW($A1))),"")
This formula could be an alternative and it returns the categories in cell E9 and below in my sample file. The formula must be entered as an arrayformula with ctrl+shift+enter if someone doesn't work with Office 365 or Excel for the web or Excel 2021.
- anl299May 07, 2024Copper ContributorThis is almost exactly what I need, the only issue is that for me it only returns the first value that meets the criteria. In my file, if I had only columns #07 and Final with values of 0 but with a weight, it would only return "#07". Same thing if I made the columns #07, #08, #09 and Final have a weight but no scores, it would only return "#07". I expect (without testing) that if my file had your data, it would only return "header4" while ignoring 8, 9 and 10.
I don't know if there is some overflowing block happening that preventing the rest of the name from showing or what.
Also, I haven't had the time to really look into your code. I'm half decent at coding, but extremely new to excel so I've never used any of the formulas or functions you used. I might be able to figure it out given enough time, but if you had any ideas right off the bat, I'm all ears
Thanks.- SergeiBaklanMay 07, 2024Diamond Contributor
As variant for the legacy Excel in F9
=IFERROR( INDEX($2:$2, AGGREGATE(15,6, COLUMN($B$2:$K$2)/($B$4:$K$4=0)/($B$6:$K$6<>0), ROW()-ROW($F$8)) ), "" )
and drag it down. No Ctrl+Shift+Enter is required.
On Excel 365 or 2021
=TOCOL( FILTER(category, (score=0)*(weight<>0) ) )
- OliverScheurichMay 07, 2024Gold Contributor
In my first reply i unfortunately forgot to mention that the formula must be dragged down from cell E9. In my sample file i entered the formula in cell E9 and confirmed it with ctrl+shift+enter. Then i dragged the formula down across range E9:E18. Since there are 4 categories with a weight and no score (in the sample file) these are now returned in range E9:E12. Cells E13:E18 are empty because the formula uses the IFERROR function to return an empty cell instead on an error message. If the entries for the weight and score are changed for a category the results update dynamically in range E9:E18. If all 10 categories have a weight and no class then all are listed in range E9:E18.
Do you work with a recent version of Excel such as Excel 2021, Office 365 or Excel for the web? If so then there are other possible solutions for this task with formulas such as TEXTJOIN and FILTER.
- anl299May 07, 2024Copper ContributorI got it to work.
Thanks!