• formula: look and choose (office xp)

    Author
    Topic
    #420894

    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.

    Viewing 1 reply thread
    Author
    Replies
    • #954381

      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.

    • #954383

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

      • #954387

        Thanks. Thank you very much.

      • #954793

        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.

    Viewing 1 reply thread
    Reply To: formula: look and choose (office xp)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: