+ Reply to Thread
Results 1 to 11 of 11

Finding EVEN numbers within a three number cell

  1. #1
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Finding EVEN numbers within a three number cell

    I'm looking to find two or more "even" numbers (2, 4, 6 or 8) within a three number cell.

    5 examples below show 4 numbers with two or more even numbers.

    247
    386
    592
    468
    861

    I've been using the following code to find double numbers with a series of cells.

    =SUMPRODUCT(--(FREQUENCY(((LEN(E28:E72)-LEN(SUBSTITUTE(E28:E72,MID(E28:E72,{1,2,3},1),"")))=2)*ROW(E28:E72),ROW(E28:E72))=2))

    I believe this formula would work but I'm striking out, any recommendations?
    Last edited by khank; 02-03-2011 at 03:56 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding EVEN numbers within a three number cell

    So are you looking to do this for each cell or for the whole range at once... and if it is the ladder then, are you trying to find 2 or more 3-digit numbers that contain 2 even digits... not sure what you mean?

    If it is the former, then perhaps: =SUMPRODUCT(--(MOD(MID(A1,ROW(INDIRECT("1:3")),1),2)=0))>=2

    copied down.. where A1 is first 3-dig number.
    Where there is a will there are many ways.

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

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

  3. #3
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Re: Finding EVEN numbers within a three number cell

    The entire range (E28:E72).

  4. #4
    Forum Contributor
    Join Date
    11-13-2010
    Location
    Warren, Michigan
    MS-Off Ver
    Excel 2008 for Mac
    Posts
    307

    Re: Finding EVEN numbers within a three number cell

    After re-reading your message the answer is

    YES "the ladder" and
    YES to find and count all cells within that column which contain 2 or more "EVEN" digits.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Finding EVEN numbers within a three number cell

    You can always use the formula I gave you as a helper column, then count the TRUEs with:

    =COUNTIF(F28:F72,TRUE) assuming you put the helper in F28:F72

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Finding EVEN numbers within a three number cell

    If you wanted a single cell calculation:

    Please Login or Register  to view this content.
    though I'm fairly sure that with thought the above could be shortened

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Finding EVEN numbers within a three number cell

    but that's counting zero too, isn't it? For just 2, 4, 6, 8 try

    =SUMPRODUCT((MMULT(LEN(E28:E72)-LEN(SUBSTITUTE(E28:E72,{2,4,6,8},"")),{1;1;1;1})>1)+0)
    Audere est facere

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Finding EVEN numbers within a three number cell

    Based on a prior thread I think 0 is meant to be treated as even...that said I'm no doubt wrong ... more to the point I can't find the prior thread as I'm sure I've seen this previously.

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Finding EVEN numbers within a three number cell


  10. #10
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Finding EVEN numbers within a three number cell

    OK, I see DO......

    my previous suggestion can be edited, just include a zero in the first array and an extra 1 in the second......

    =SUMPRODUCT((MMULT(LEN(E28:E72)-LEN(SUBSTITUTE(E28:E72,{0,2,4,6,8},"")),{1;1;1;1;1})>1)+0)

    ...which would be an approach you could use to count any combination of digits......or for even digits (including zero) try

    =SUMPRODUCT((MMULT(1-MOD(MID(E28:E72&111,{1,2,3},1),2),{1;1;1})>1)+0)

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

    Re: Finding EVEN numbers within a three number cell

    So, in the end it wouldn't it be easier to use the helper column.. at least most average users would be able to understand what is going in even 10 years from now

+ 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.6.0 RC 1