+ Reply to Thread
Results 1 to 5 of 5

Ideas for numbers or text in range of cells

  1. #1
    Registered User
    Join Date
    06-21-2011
    Location
    st louis, mo
    MS-Off Ver
    Excel 2010
    Posts
    28

    Ideas for numbers or text in range of cells

    I am trying to enter an equation in cells in column A to identify which cells from the range B1 to I1 that contain a value of 3 or the text string MAX. The number that should be displayed represents the position(s) of the number 3's or MAX's that may exist. Column B=1, Column C=2, Column D=3, etc. Thanks in advance for any suggestions.
    Attached Files Attached Files

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Ideas for numbers or text in range of cells

    I guess you could use these:

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


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


    then select A1:A2 and drag down

  3. #3
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Ideas for numbers or text in range of cells

    So you're doing a couple of things that are each not too hard, but when you try to jam them both into one cell, you've got a mess.

    A1 = COUNTIF(B1:I1, 3) will count HOW MANY cells contain the value 3.
    A2 = COUNTIF(B2:I2, "MAX") will count HOW MANY cells contain the text string "MAX".

    A1 = INDEX(3, B1:I1, 0) will return the element number (1, 2, 3, etc) inside the array B1:I1 of the FIRST cell that contains the value 3.
    A2 = INDEX("MAX", B2:I2, 0) will return the element number (1, 2, 3, etc) inside the array B1:I1 of the FIRST cell that contains the text "MAX".

    But... if you want to test every cell, I think the only way you can do it is, with a brute force stack of IFs reading along the row.

    A1 = IF(B2=3, column(b2)-1, "") & IF(C2=3, column(c2)-1,"") & etc

    Anyway I'd create a helper column (in J:J for example) so that you can test IF(B2= J2) & etc; then you can just pull down the A column rather than retyping it a bunch. And fill in J:J with "3", "MAX", etc.

    EDIT:
    Oh yeah and the "" getting stuck on there forces it to a text string, wrap in with value like VALUE(IF&IF&etc) to force it back to a number if you need to feed it into some kinda function in another program.
    Last edited by ben_hensel; 07-16-2012 at 04:31 PM.

  4. #4
    Registered User
    Join Date
    06-21-2011
    Location
    st louis, mo
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Ideas for numbers or text in range of cells

    Thanks. that did exactly what i was looking for.

  5. #5
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Ideas for numbers or text in range of cells

    If you're referring to me, you're welcome.
    Based on your last post I'll mark your thread as SOLVED. Please remember that rule #9 requires you to do that yourself. Thanks.

+ 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