0

I’m trying to automate some processes for task management, but I’m having no success. I can’t use macros or similar, just formulas, and I’m not an adept at spreadsheet hacking.

Anyways, here’s my workbook, with its **sheets**:

**Form**
TASK     LI    DE    X
Test     1     3
Test2    2

**LI**
WEEK     TASK  COMPLETED
1        Test
2        Test
2        Test  *
4        Test2 *

**DE**
WEEK     TASK  COMPLETED
1        Test  *

What I’ve been trying to do is:

  • On Form, check which column, from LI or DE, is > 0.
  • For each one > 0, check for the existence of TASK on its respective sheet (LI or DE).
  • If it is there, check if it has an *.
  • If it has an *, take the WEEK number of that row, compare it to the WEEK from the other sheet, take the greater number, and load it into the X column of the TASK on Form. The order here doesn’t really matter. I just need the WEEK from the one with an *.

For this example, in order for X to change, TASK must be with an * in the sheets where it is. For instance, if, on Form, Test has numbers in LI and DE, and Test has an * in LI sheet, but not in DE sheet, X must remain empty. But if both have it with *, X must be loaded with the greater WEEK between LI and DE.

If I were to do it with macros, I would simply check each column with a loop, but with formulas I suppose nested IFs would suffice.

I’ve tried with VLOOKUP, but it only takes the first item in the array, and though the order doesn’t matter, it is generally (I think I will make this a policy) the last value.

Any doubt, just let me know! I hope I made my issue clear.

Thank you very much in advance!

1 Answer 1

2

I think you can do it with formula but as you will have to loop, you will need SUMPRODUCT or Array Formula.

Here is a formula you can try (validate with CtrlShiftEnter):

=MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))

Some explanation:

  • The MAX formula will find the greatest value between the two ARRAY FORMULA of the two worsheets
  • The array formula works like a multiple loop test:
    • (LI!$C$2:$C$5="*") checks if there is a star in the third column
    • (LI!$A$2:$A$5) will return the week number
    • (LI!$B$2:$B$5=Form!A2) will check if the tasks are the same

I hope I understood well what you intended to do :)

[EDIT] Another try thanks to your comment (both task should be completed to appear)

=IF(AND((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2))),MAX((LI!$C$2:$C$5="*")*(LI!$A$2:$A$5)*(LI!$B$2:$B$5=Form!A2),(DE!$C$2:$C$5="*")*(DE!$A$2:$A$5)*(DE!$B$2:$B$5=Form!A2)),"")
5
  • How the...! I would have never found the answer just reading “formula” descriptions. Thank you very much! Just out of curiosity, is there a way to break the MAX (so that the cell stays empty) if one of the numbers is false? I mean, like I said, if the task is assigned to two sheets, BOTH have to have the TASK with *, otherwise the X column should stay empty. Thanks again! Sep 21, 2011 at 18:55
  • I’m reading more about the array formula. Too good to be true, too obscure to be known. Thanks for this tip! Sep 21, 2011 at 19:02
  • I've added another try but I couldn't test it right here though (maybe tomorrow). Tell me if that works better.
    – JMax
    Sep 21, 2011 at 19:27
  • For AND, I had to use MAX for each logical member, individually, otherwise it would only evaluate the WEEK value of the first TASK matching Form!A2. I’m going to keep testing. The logic should be fine (only return the one with *), but for some reason, it doesn’t. Anyways, for now, with MAX in AND members seems to be doing just fine. I’m also going to have to test performance... Thank you very much! Sep 21, 2011 at 20:48
  • It’s been a mess to get everything working with just formulas, but your help was exactly what I was looking for. At least the most hard-to-find answer I needed. Thanks! Oct 3, 2011 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.