Results 1 to 6 of 6

Replace cell value based on a logic statement

Threaded View

  1. #5
    Registered User
    Join Date
    01-16-2014
    Location
    Davis, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Replace cell value based on a logic statement

    Hi,

    Your formula works but in my situation is missing a component because of a detail I didn't provide. In my data set I have values other than A or C. Therefore, if I ran the formula above to this data:
    A A A C A
    C N A M C

    It would put:

    1 1 1 2 1
    2 2 2 2 2

    When I would like for it to look like this:

    1 1 1 2 1
    1 N 2 M 1

    I thought about putting an If statement beginning of your function above but don't know how to get the 'A1= "A" or "C"' to work. This is what I have so far:

    =IF(A1=OR("A","C"), (2-(COUNTIF($A1:$E1,A1)>COUNTA($A1:$E1)/2)), A1)

    Just an added detail, there are many other letters besides what I have in the example above (M and N) in the array, and of course, this is just a very small subset size of the data I am trying to convert.

    I also thought about more about what to do in case count of A and C are equal. I think I will just default to having whatever is in the first cell in the range (A1 for row 1) as "2" and the alternate as "1". The first column will always have A or C and I wouldn't need to worry about other letters.
    Last edited by spujr; 01-17-2014 at 03:49 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Splitting a Cell based on "/" and adding new Rows based on Part Number Logic
    By NeedForExcel in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-30-2013, 10:11 AM
  2. Text in a single cell based on logic of multiple other cells
    By dtrimble in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-12-2013, 01:33 AM
  3. IF Statement: Replace Cell with True Value
    By firehousetk in forum Excel General
    Replies: 5
    Last Post: 11-01-2011, 04:44 PM
  4. Macro logic: extract higher/lower values based on Unique Cell
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2009, 03:11 AM
  5. Help: Logic for reading/writing cell values based on dual combobox selections
    By MyUserName in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2006, 09:16 PM

Tags for this Thread

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