Share via

Shorten Formula

Anonymous
2024-08-11T07:47:43+00:00

Hello to everybody,

I have plenty of this formula with OR and AND nested functions/conditions:

=IF(OR(AND(PAIRS!E59="BUY";PAIRS!E61="BUY";PAIRS!E63="BUY";PAIRS!E65="BUY");OR(PAIRS!E67="BUY";PAIRS!E83="BUY";PAIRS!E81="BUY";PAIRS!E89="BUY");OR(PAIRS!E69="BUY"));"MN trend BUY";"")

=IF(OR(AND(PAIRS!H5="BUY";PAIRS!H7="BUY";PAIRS!H9="BUY";PAIRS!H11="BUY";PAIRS!H13="BUY";PAIRS!H21="BUY");OR(PAIRS!H15="BUY";PAIRS!H17="BUY"));"W1 Trend Buy";"")

Is there please a way to shorten or write the formula is a better and readable way?
Thank you in advance.
Regards John

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2024-08-13T10:40:33+00:00

As a small side note:

 OR(Pairs!E67 = "BUY", Pairs!E83 = "BUY", Pairs!E81 = "BUY", Pairs!E89 = "BUY"), 

 OR(Pairs!E69 = "BUY")

Or(a,b,c), Or(d)  can be simplified to just Or(a,b,c,d)

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

Answer accepted by question author

riny 20,870 Reputation points Volunteer Moderator
2024-08-11T08:56:59+00:00

Difficult to say without seeing the lay-out of your schedule and without knowing what Excel version you are using.

The 2nd formula references 5 alternating rows like H7, H9, H11, H13 and H15. Then it hops over 7 rows and references H21. Could you re-design the schedule so that you can address entire ranges rather than individual cells?

With a modern Excel version, the formula could then look something like this (note my Excel version uses commas to separate function arguments):

=IF(OR(SUM(--(PAIRS!H5:H10="BUY"))=6,SUM(--(PAIRS!H12:H13="BUY"))>0),"W1 Trend Buy","")

And I'm sure others can come-up with alternatives.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2024-08-11T10:14:09+00:00

    Thank you for your answer and much better solution than mine.
    I'll revise the project to avoid mistakes in my "old" formulas.

    Thansk again.
    Regard John.

    Was this answer helpful?

    0 comments No comments