jeudi 4 octobre 2018

Excel: Multiple IF AND OR statements to select values based on different hierarchies

I have 2 columns of data in columns AX and AY. Each value in the cell represents a categorical value, namely "Strong", "Good", "Moderate", "Weak", arranged in decreasing order of strength of evidence, i.e. Weak evidence to support... Strong evidence to support etc.

I want to create a new column that chooses the lower strength of evidence category. For e.g, if AX2 = Weak, and AY2 = Strong, AZ2 = Weak (where AZ is the new column I want the new values to fall into). Similarly, if AX3 = Good, and AY3 = Moderate, then AZ3 = "Moderate".

If there was some way for me to set a hierarchy, similar to spatial thinking concepts in GIS where the minimal value is selected, whereby the value in AZ will be the minimum value (i.e. of lower strength of evidence) between AX and AY, i.e. choosing one of the 2 cell values.

In Excel, I tried doing this using the IF, AND, OR statements, and was thinking of doing e.g. If AX = Weak and AY is any of the four, AZ = Weak. And I was thinking of repeating this for the other scenarios e.g. If AX = Moderate and AY is any of the 3 (Moderate, Good, Strong), AZ = Moderate.

(My code)

=IF(AND(AX4="Weak",OR(AY4="Weak",AY4="Moderate",AY4="Good",AY4="Strong")),"Weak"," ")

Then I realized, while currently I am attempting to fix the value for AX, while using OR functions for AY, I would have to repeat the same thing in the other direction, i.e. fix a value for AY, then using OR functions for AX, to prevent myself from excluding certain scenarios

My current code only works for creating AZ values = Weak, and when I attempted to have multiple OR functions at the start to define different scenarios, I received the error message telling me that was too many arguments.

I have come to the conclusion that the way I am attempting to perform this task is very inefficient, and would greatly value any and all advice.

Aucun commentaire:

Enregistrer un commentaire