+ Reply to Thread
Results 1 to 24 of 24

SUMIFS and LOOKUP function resulted to NULL value

  1. #1
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Question SUMIFS and LOOKUP function resulted to NULL value

    Hi All!

    So I was trying to compute for the sum of all values of the "Assignments" in Data 1 that are classified as "Z1" in Data 2. I used the Lookup function as one of the criteria enclosed in SUMIFS but the returned value after resulted to null.

    Please help me figure out the better way or correct way to do it.

    I wrote the formula like this:

    =SUM(SUMIFS('Data 1'!$I:$I,'Data 1'!$G:$G,Report!$C$2,'Data 1'!$A:$A,">="&Report!D$4,'Data 1'!$A:$A,"<="&EOMONTH(Report!D$4,0),'Data 1'!$E:$E,{"ZP","KZ"},'Data 1'!$C:$C,{"21200101","21300502"},'Data 1'!$B:$B,LOOKUP(Report!$B5,'Data 2'!$A:$A,'Data 2'!$B:$B)))

    Please see the attachment for the sample file:

    SampleProblemSUMIFSandLOOKUPfile.xlsx

    [EDITED] There was a precondition of not adding any helper column to either Data 1 or Data 2. Would you know if there is a way to capture the values without adding a helper column?
    Last edited by hesamson; 08-19-2022 at 10:42 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    In Sheet Data 1, I would add a Helper Column (J) with:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    copied down.

    Then this:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Note that the G/L Account Numbers are NOT in double quotes.

    And why have you got thousands of blank rows in this sample file?
    Attached Files Attached Files
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Hello TMS! Thank you for the prompt help. I apologize, I didn't mention that there was a precondition of not adding any column in the Data 1 or Data 2 worksheet. Would you know if there's a way it won't result in a null value without the added helper column?

    Apologies for the empty rows of the first file, I just re-uploaded a much better one

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    You're welcome. Thanks for the rep.

    Oops. Big omission.

    The LOOKUP doesn't work. FULL STOP. In isolation, try: =LOOKUP(Report!$B10,'Data 2'!$A:$A,'Data 2'!$B:$B)

    Pretty sure it will always return the very last entry in Data 2 column B. Column A would need to be sorted but, even then, it won't be giving you what you want.

    You could try putting the helper column on a separate sheet. The problem there is keeping it in sync.

    I'll have to think about it but don't hold your breath.

  5. #5
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Still trying to find out what other functions can work too. Huge thanks for the inputs~ Hopefully, something will come up.

  6. #6
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: SUMIFS and LOOKUP function resulted to NULL value

    You will not be able to do this using sumifs without a helper column, as you can only have two criteria using arrays.
    With your version of Excel it may be possible to do it with sumproduct, but I cannot figure out how.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Figured out a way, but it's slow, volatile & may need to be confirmed with Ctrl Shift Enter with xl 2016
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @Fluff: that's impressive BUT, if you change the date to, say, February or March, the value doesn't move. Am I missing something? For example, Data 1, Row 13, change the date to February.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Am I missing something?
    Nope, I forgot to anchor the B5 cell reference, it should be
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Thanks for spotting it
    Attached Files Attached Files

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Sorted. Nice work. As you say, slow, but does the job.

  11. #11
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    I also found a formula that doesn't require a helper.
    Please try
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I have tested this formula and it seems to work well.
    This formula is fast, because the number of operations needed is relatively limited and it doesn't use functions known to be slow.

    EDIT: This workbook contains an error. The corrected workbook is in post #15
    Attached Files Attached Files
    Last edited by HansDouwe; 08-18-2022 at 03:22 PM.

  12. #12
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @Hans: your formula, corrected:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    There were a couple of errors ( Data 2'! and a semi-colon) and B5 not locked.
    Last edited by TMS; 08-18-2022 at 12:13 PM.

  13. #13
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @TMS, I see you changed $B5 to B5, but $B5 is correct and B5 is not correct.
    $B5 is the planning group and it is in 1 column.

    Edit, What I'm writing here is wrong, It's the other way around.
    Sorry.
    Thanks for the corrections.
    I will adjust my sheet.


    The semicolumn was a translate-error. I will work more accurately next time.
    Last edited by HansDouwe; 08-18-2022 at 12:41 PM.

  14. #14
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,075

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @HansDouwe
    I would also suggest adding an IFNA otherwise the formula will only work if the exact range is used, which is not normally very practical.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  15. #15
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Here is a corrected workbook and formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    @TMS, thx for adressing the errors.

    Sry for the confusion!

    This formula is fast, because the number of operations needed is relatively limited and it doesn't use functions known to be slow.

    I look forward for your feedback.
    Attached Files Attached Files
    Last edited by HansDouwe; 08-18-2022 at 03:25 PM.

  16. #16
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Quote Originally Posted by Fluff13 View Post
    @HansDouwe
    I would also suggest adding an IFNA otherwise the formula will only work if the exact range is used, which is not normally very practical.
    Good tip. I agree.
    Last edited by HansDouwe; 08-18-2022 at 01:08 PM.

  17. #17
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Hello pals, thanks for a lot of help. I tried recreating the formula, in the same file and set of data, but it prompted #VALUE! on the cell. I selected the entire column for the ranges. Also, is there an effect if the Assignment Column in Data 1 is not in a uniform format? Other contents are in text form and others are in number form.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by hesamson; 08-19-2022 at 01:52 AM.

  18. #18
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Hello Hesamson,

    Thx for the rep.
    The #VALUE error occurred because SUM cannot handle the alphanumeric values in the headers.
    To prevent problems with a wrong range, you can put the data in a table and refer to it. See attachment.

    Furthermore, your formula gives a result of 179,520,639,284.00, because account 21200101 was incorrectly removed from the formula.
    I have indicated in the sheet how the account should be removed from the formula if that is the intention.

    In case of any questions or comments I would like to hear that
    Attached Files Attached Files

  19. #19
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    As well as the problem of the headers being introduced to the range, you should ( MUST ) avoid full range references in array functions. Every column contains over a million cells and you are matrix multiplying lots of them together. I'd be surprised if the calculation was not VERY slow.

  20. #20
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @TMS I know.
    In my solution I AVOID full range references.
    I use only the reference of the table not the whole columns.
    The calculation was VERY fast.

    Values below the table are not involved in the calculation.
    Last edited by HansDouwe; 08-19-2022 at 08:30 AM.

  21. #21
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: SUMIFS and LOOKUP function resulted to NULL value

    @Hans: yes, I know. The point was made to the OP who is breaking your formula.

  22. #22
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Hello Hans,

    Thanks for your patience. I finally managed to use it properly. Problem solved thank you again!

  23. #23
    Registered User
    Join Date
    08-17-2022
    Location
    Manila, Philippines
    MS-Off Ver
    MSO 365
    Posts
    9

    Re: SUMIFS and LOOKUP function resulted to NULL value

    Thank you pals for the help. I learned a lot from this

  24. #24
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,419

    Re: SUMIFS and LOOKUP function resulted to NULL value

    You're welcome. I also learned a lot from your question when answering it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Lookup a referenced value for the last available non-zero, non-null date.
    By Aidan_Sweeney in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-02-2017, 08:16 AM
  2. LOOKUP Returning Null Results For Unknown Reason
    By Magikjak in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-23-2014, 03:48 AM
  3. [SOLVED] The TRANSPOSE() function resulted in cells with unnecessary #N/A values
    By zjianguk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-18-2013, 04:55 PM
  4. How to embed lookup function from a dropdown list within SUMIFS
    By exlstudent in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-30-2012, 03:08 PM
  5. [SOLVED] Compare with Date TODAY function, and have resulted in year to DateDiff Via VBA
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-07-2012, 01:18 PM
  6. Lookup only non null values
    By Graydoggy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2008, 05:33 PM
  7. [SOLVED] need Lookup table to return null or zero
    By simbob in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-24-2005, 09:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1