Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Aug 2004
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    formula: look and choose (office xp)

    Thanks. I would like to make Excel formula that need to choose between T and F from 2 columns and put it into one column.

    i.e. Take T from column A when there is a T there and alternate take F from column B when there is a F there.
    Attached is the sample file with the result manually done. anyone can help me here please?
    Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: formula: look and choose (office xp)

    Perhaps this can be done in a formula, but a macro is easier (at least for me):

    Sub FillTF()
    Dim lngMaxRow As Long
    Dim lngRow As Long
    Dim strPrev As String
    Dim strCurr As String
    strCurr = "F"
    lngMaxRow = Range("A65536").End(xlUp).Row
    For lngRow = 3 To lngMaxRow
    strPrev = strCurr
    If strPrev = "F" And Range("A" & lngRow) = "T" Then
    Range("C" & lngRow) = "T"
    strCurr = "T"
    ElseIf Range("B" & lngRow) = "F" Then
    Range("C" & lngRow) = "F"
    strCurr = "F"
    Else
    Range("C" & lngRow).ClearContents
    End If
    Next lngRow
    End Sub

    Run this macro after columns A and B have been filled in.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: formula: look and choose (office xp)

    Here is a solution using formulas. It uses an intermediary column (column D) that has been hidden.

  4. #4
    2 Star Lounger
    Join Date
    Aug 2004
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: formula: look and choose (office xp)

    Thanks. Thank you very much.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2002
    Location
    The Hague, Netherlands
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: formula: look and choose (office xp)

    C3:

    =IF(LOOKUP(REPT("z",255),$C$1:C2)="T",IF(B3="F","F ",0),IF(A3="T","T",0))

    custom formatted as: [=0]"";General and copied down might be faster.
    Microsoft MVP - Excel

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: formula: look and choose (office xp)

    Nice! <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •