I have a "table" on a separate worksheet & set it up to use a lookup formula (rather than a vlookup formula) since the lookup vector is one column (not the first one in the table) and the result vector is one column (which is the first one in the table), and that was clearer visually. I had originally set the table up with ranges (e.g. >8<=16, >16<=24, etc.), but found lookup doesn't like that and will only search for the greatest comparison value that is less than or equal to the lookup value. In addition, I will need to add several lookup value results together and will need to be able to copy them down with the rows relatively adjusting in column C of the comparison & formula sheet. (The table is on a separate sheet.)
After attempting to adjust my table accordingly, I realized I had to deal with a situation where a result was less than 3. Anything less than 3 I want the result to be zero, but if my comparison is equal to 3, I want the result to be 1. Therein was a challenge.
I considered doing a false statement to return an exact match, but that will only be useful if the comparison is exactly 3 (unlikely, but possible). All the rest of my values can't use an exact match.
I came up with a nested IF statement using lookup as follows, but it isn't getting past the logical test to return the value if false portion, and I don't know if it's the syntax & use of brackets, or my logic, or my table:
=IF(($C2<3),0,LOOKUP($C2,DayTable!$B$2:$B$21,$A$2:$A$21))+IF(($C3<3),0,LOOKUP($C3,DayTable!$B$2:$B$21,$A$2:$A$21))+IF(($C4<3),0,LOOKUP($C4,DayTable!$B$2:$B$21,$A$2:$A$21))
Alternatively, Excel suggested the following formula, but the results were the same and not returning the correct results:
=IF($C4<3,0,LOOKUP($C4,DayTable!$B$2:$B$21,$A$2:$A$23)+IF($C5<3,0,LOOKUP($C5,DayTable!$B$2:$B$21,$A$2:$A$23)+IF($C6<3,0,LOOKUP($C6,DayTable!$B$2:$B$21,$A$2:$A$23))))
I can attach a sample spreadsheet if that would be helpful, but I would need to adjust it to protect confidentiality. I'm a bit perplexed as to why this isn't working or how to achieve the desired results. Any suggestions would be welcome!
Bookmarks