+ Reply to Thread
Results 1 to 6 of 6

Sumproduct-select a range

Hybrid View

  1. #1
    Registered User
    Join Date
    03-09-2007
    Posts
    6

    Sumproduct-select a range

    Hi guys, I'm trying to select a range of cells to test a text value using if condition but for soem reason it is not working! for example if i use :
    =IF (OR(a1="mike",b10="mike",c4="mike"),1,"") this will work fine but is there any other way to write this formula so i do not have to write every single cell and just chose them.

    thanx in advance.
    Last edited by hanymon; 03-09-2007 at 10:17 PM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    hanymon

    Please change Title of your thread or you may find your post deleted

    For More Info see
    http://www.excelforum.com/showthread.php?t=591596
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    If you're trying to count the number of occurrences of "Mike" in a range, use this formula:

    =SUMPRODUCT(--(A1:E10="mike"))

    If you're just trying to see if "Mike" exists anywhere in the range, and if so, put a 1 in the cell with the formula, use this:

    =IF(SUMPRODUCT(--(A1:E10="mike"))>0,1,"")


    Adjust your range as needed, A1:E10 is just an example.

  4. #4
    Registered User
    Join Date
    03-09-2007
    Posts
    6
    Thank you, PJoaquin, your second answer did the job, and i do appologize if i did post this way it is my first time on this site and i did not know what are the rules, but thanks again for the help

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523
    So change the title,

    If somebody was searching the forum for "if or" formula, they would never think of searching for
    "anybody has an idea?"

    The majority of searches find the titles

  6. #6
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,700
    Quote Originally Posted by pjoaquin
    =IF(SUMPRODUCT(--(A1:E10="mike"))>0,1,"")
    Of course SUMPRODUCT works fine here but the normal approach would be to use COUNTIF, e.g.

    =IF(COUNTIF(A1:E10,"Mike"),1,"")

+ 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