+ Reply to Thread
Results 1 to 12 of 12

Thread: If sumproduct formula question

  1. #1
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    327

    If sumproduct formula question

    Hello,

    I am encountering a small problem with the following formula and I can't seem to get it to function correctly. The range is FD4:FM4, the values are numbers (which are obtained by other formulas) while some of the cells are blanks. Here is the formula,


    =IF(SUMPRODUCT(--(FD4>=0)*(FD4<=1)+(FE4>=0)*(FE4<=2)+(FF4>=0)*(FF4<=1)+(FG4>=0)*(FG4<=2)+(FH4>=0)*(FH4<=1)+(FI4>=0)*(FI4<=2)+(FJ4>=0)*(FJ4<=1)+(FK4>=0)*(FK4<=2)+(FL4>=0)*(FL4<=1)+(FM4>=0)*(FM4<=1)),CHAR(252),CHAR(251))
    I am looking to get a checkmark if

    FD4 is between 0 and 1
    FE4 0 and 2
    FF4 0 and 1
    FG4 0 and 2
    FH4 0 and 1
    FI4 0 and 2
    FJ4 0 and 1
    FK4 0 and 2
    FL4 0 and 1
    FM4 0 and 2

    Also, generally speaking, does excel see the any blank cells as zeros?

    Thank you,
    Sans
    Last edited by sans; 11-18-2011 at 04:57 PM.

  2. #2
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: If sumproduct formula question

    You could use Boolean - it may be easier to read

    =AND(FD4>=0,FD4<=1,FE4>=0,FE4<=2 etc etc)

    edvwvw

  3. #3
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If sumproduct formula question

    yes the blanks are seen as 0's here...

    Try first replacing all the + to * in the formula

    and for each cell add another condition, e.g. =SUMPRODUCT((FD4<>"")*(FD4>=0)*(FD4<=1)*(FE4<>"")*(FE4>=0)*(FE4<=2)*.....
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  4. #4
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    327

    Re: If sumproduct formula question

    Thank you for replying. I have tried both

    =IF(SUMPRODUCT(--(FD4<>"")*(FD4>=0)*(FD4<=1)*(FE4<>"")*(FE4>=0)*(FE4<=2)*(FF4<>"")*(FF4>=0)*(FF4<=1)*(FG4<>"")*(FG4>=0)*(FG4<=2)*(FH4<>"")*(FH4>=0)*(FH4<=1)*(FI4<>"")*(FI4>=0)*(FI4<=2)*(FJ4<>"")*(FJ4>=0)*(FJ4<=1)*(FK4<>"")*(FK4>=0)*(FK4<=2)*(FL4<>"")*(FL4>=0)*(FL4<=1)*(FM4<>"")*(FM4>=0)*(FM4<=1)),CHAR(252),CHAR(251))
    and

    =IF(AND(FD4>=0,FD4<=1,FE4>=0,FE4<=2,FF4>=0,FF4<=1,FG4>=0,FG4<=1),"Yes","No")
    but I am getting incorrect results for some reason. Is it possible that the formulas in the cells FD4:FM4 can be a problem?

    Thank you,
    Sans

  5. #5
    Forum Contributor
    Join Date
    05-27-2008
    Location
    Newcastle Upon Tyne UK
    MS-Off Ver
    XP Excel 2003
    Posts
    105

    Re: If sumproduct formula question

    sans

    You will need to make some changes to my solution - if it is going to be the same as NBVC.

    =(AND(FD4<>"", FD4>=0, FD4<=1, etc, etc, etc
    edvwvw

  6. #6
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If sumproduct formula question

    What kind of formulas do you have in that range?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  7. #7
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    327

    Re: If sumproduct formula question

    This is the formula,

    =IF(COUNTIF(KT4:KZ4,1)=0,"",COUNTIF(KT4:KZ4,1)))
    =IF(COUNTIF(KT4:KZ4,2)=0,"",COUNTIF(KT4:KZ4,2)))...

    in all of the cells.

    Thank you, Sans

  8. #8
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If sumproduct formula question

    It seems to work for me in my testing...

    can you post a sample workbook indicating where it is going wrong?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  9. #9
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    327

    Re: If sumproduct formula question

    I also copied only the values of FD4:FM4 to a new sheet but still I am encountering a problem.

    I have attached a sample. Thank you,
    Sans
    Attached Files Attached Files

  10. #10
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If sumproduct formula question

    I thought all the cells have to have a number between 0 and 1 or 2 to get a checkmark and so that if any have a blank then you should get an x. Did I misinterpret?
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  11. #11
    Forum Guru NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    32,636

    Re: If sumproduct formula question

    Maybe you want?

    =IF(SUMPRODUCT((N(D3)>=0)*(N(D3)<=1)*(N(E3)>=0)*(N(E3)<=2)*(N(F3)>=0)*(N(F3)<=1)*(N(G3)>=0)*(N(G3)<=2)*(N(H3)>=0)*(N(H3)<=1)*(N(I3)>=0)*(N(I3)<=2)*(N(J3)>=0)*(N(J3)<=1)*(N(K3)>=0)*(N(K3)<=2)*(N(L3)>=0)*(N(L3)<=1)*(N(M3)>=0)*(N(M3)<=1)),CHAR(252),CHAR(251))
    Microsoft MVP - Excel

    Where there is a will there are many ways. Pick One!


    Please read the Forum Rules

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

    Preferred Charities: Lupus Canada and Sick Kids Foundation.
    Feel Free to Donate if you want to, for the assistance you received today.

  12. #12
    Valued Forum Contributor sans's Avatar
    Join Date
    10-19-2011
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    327

    Re: If sumproduct formula question

    Sorry about that, I just read my original post and it's not clear indeed.

    The formula works great. Thank you. It's the first time I see the N used in a formula so I checked and found that the N converts a value to a number. Did you use it because the cells were obtained by formulas?
    Thank you for your help,
    Sans

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0