+ Reply to Thread
Results 1 to 7 of 7

Return characters based on another column

  1. #1
    Registered User
    Join Date
    02-04-2008
    Posts
    30

    Cool Return characters based on another column

    Is there a way to look in a column and get a return based on the numbers in that column?

    For example, say I have the following numbers in the following cells


    A1 = 3
    A2 = 6
    A3 = 8
    A4 = 3
    A5 = 3
    A6 = 2
    A7 = 8
    A8 = 9


    I want to somehow look through column A and if there is a number that I have not seen before, return the number "1" in column B.
    Esentially, I'd like to see....

    A1 = 3 ........... B1 = 1
    A2 = 6 ........... B2 = 1
    A3 = 8 ........... B3 = 1
    A4 = 3 ........... B4 =
    A5 = 3 ........... B5 =
    A6 = 2 ........... B6 = 1
    A7 = 8 ........... B7 =
    A8 = 9 ........... B8 = 1

    Is there a way to do this using VBA?
    Also, if a cell was blank in column A, I'd like that to be skipped....meaning no return in B would come from a blank cell in A.

    Thanks in advance!!!

  2. #2
    Registered User
    Join Date
    02-04-2008
    Posts
    30
    In a ruff sense, if a column is not empty, then look in the column

    If the number is new, return "1" else number is not new, return ""

    Something along those regards but this is just a first thought....there may be an easier way. The main part of this is to find a number and return a "1" but then every time that number re-appears, skip it....returning ""

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    By just using a simple formula...you don't need VBA....

    =IF(COUNTIF($A$1:A1,A1)=1,1,"") copied down
    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.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

  5. #5
    Registered User
    Join Date
    02-04-2008
    Posts
    30
    NBVC - PERFECT! The function works great though -- thank you!!! Works like a charm but is there a way to do this in VBA? That way, If I have a lot of points, I don't have to drag to the end.

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    This will automatically insert my formula into column B adjacent to Column A down to last row.

    Please Login or Register  to view this content.
    Note: Please remember to tell us you cross-posted next time and show the link. Please read this to understand why: http://www.excelguru.ca/node/7

  7. #7
    Registered User
    Join Date
    02-04-2008
    Posts
    30
    NBVC,

    Thank you for your time and help...that did it.
    Sorry for the cross-post

    But again, thank you thank you thank you for the help......!!!

    Problem solved.

+ 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