Lookup Formula

Roushcj

New Member
Joined
Aug 18, 2022
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
Hello, I am looking to see if there is a formula that will give me the values in column C below. What I am looking to do is if the Transaction ID is the same and there is no red step in column B then code all of column c as igo for that transaction ID. I used a vlookup but am potential going to use this data in another system that doesn't us vlookups. The actually data does not have coloring but is indicated by the word NIGO on the Step name.
A​
B​
C​
Transaction IDStepsIGO/NIGO
1234Step 1 IGO
1234Step 2IGO
1234Step 3IGO
5678Step 1NIGO
5678Step 2NIGO
5678Step 3NIGO
5678Step 4NIGO
5678Step 5NIGO
5678Step 6NIGO
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Unfortunately, you can't make a formula that uses font color in the formula itself. You can however make code that uses font color.

This code does the trick.

VBA Code:
Public Sub IGONIGO()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim m As Integer
Dim n As Integer
Dim IGO As String
Dim NIGO As String

For i = 2 To WorksheetFunction.CountA(Range("a1:a1000"))
   
    IGO = ""
    NIGO = ""
   
    j = WorksheetFunction.CountIf(Range("a2:a1000"), Cells(i, 1).Value) - 1
   
    m = Cells(i, 1).Value
   
  
   
    For k = 0 To j
       
        If Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex = 1 Then
       
        IGO = "IGO"
       
        ElseIf Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex <> 1 Then
        NIGO = "NIGO"
        End If
       
   
    Next k
   
    For n = 0 To j
   
    If NIGO <> "" Then
        Cells(i + n, 3).Value = NIGO
    Else
        Cells(i + n, 3).Value = IGO
    End If
   
    Next n
   
    i = i + j
Next i

End Sub
 
Upvote 0
This will work as long as you don't change what columns these pieces of data are in.
 
Upvote 0
Unfortunately, you can't make a formula that uses font color in the formula itself. You can however make code that uses font color.

This code does the trick.

VBA Code:
Public Sub IGONIGO()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim m As Integer
Dim n As Integer
Dim IGO As String
Dim NIGO As String

For i = 2 To WorksheetFunction.CountA(Range("a1:a1000"))
  
    IGO = ""
    NIGO = ""
  
    j = WorksheetFunction.CountIf(Range("a2:a1000"), Cells(i, 1).Value) - 1
  
    m = Cells(i, 1).Value
  
 
  
    For k = 0 To j
      
        If Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex = 1 Then
      
        IGO = "IGO"
      
        ElseIf Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex <> 1 Then
        NIGO = "NIGO"
        End If
      
  
    Next k
  
    For n = 0 To j
  
    If NIGO <> "" Then
        Cells(i + n, 3).Value = NIGO
    Else
        Cells(i + n, 3).Value = IGO
    End If
  
    Next n
  
    i = i + j
Next i

End Sub
Unfortunately, you can't make a formula that uses font color in the formula itself. You can however make code that uses font color.

This code does the trick.

VBA Code:
Public Sub IGONIGO()
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim m As Integer
Dim n As Integer
Dim IGO As String
Dim NIGO As String

For i = 2 To WorksheetFunction.CountA(Range("a1:a1000"))
  
    IGO = ""
    NIGO = ""
  
    j = WorksheetFunction.CountIf(Range("a2:a1000"), Cells(i, 1).Value) - 1
  
    m = Cells(i, 1).Value
  
 
  
    For k = 0 To j
      
        If Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex = 1 Then
      
        IGO = "IGO"
      
        ElseIf Cells(i + k, 1).Value = m And Cells(i + k, 2).Font.ColorIndex <> 1 Then
        NIGO = "NIGO"
        End If
      
  
    Next k
  
    For n = 0 To j
  
    If NIGO <> "" Then
        Cells(i + n, 3).Value = NIGO
    Else
        Cells(i + n, 3).Value = IGO
    End If
  
    Next n
  
    i = i + j
Next i

End Sub
Is there a way to do it with only formulas like an if statement. I will have to move this into a program like excel that doesn't have vba capabilities. The color coding of red was just to show that step was nigo. In the actual data I would be looking for the word nigo. For example if on step for ID 5678 has the word nigo in column b I want all lines for ID 5678 to be the word nigo in column c.
 
Upvote 0
Could you give a few more examples? I am seeing that you want the IGO or NIGO to show up if in the same column and same transaction ID that you want it to be whatever the other IGO or NIGO.
 
Upvote 0
Could you give a few more examples? I am seeing that you want the IGO or NIGO to show up if in the same column and same transaction ID that you want it to be whatever the other IGO or NIGO.
Here is another sheet with a little less generic data. You can see on line 6, 7, 8 the Category is NIGO because one of these lines exist for Transaction ID 1234 then the result in column C for transaction ID 1234 is NIGO for all of them. This is the same for 8765. For 5678 and 2121 the result is IGO because the no category is NIGO for each of these ids. I am looking to see if there is a formula for column C that is not a VLOOKUP that can look at all the same ID for column A then look at column B and add the correct word IGO or NIGO in column C. Thanks
ABC
1Transaction IDCategoryResult
2
1234​
ReviewNIGO
3
1234​
ReviewNIGO
4
1234​
CashieringNIGO
5
1234​
CashieringNIGO
6
1234​
NIGONIGO
7
1234​
NIGONIGO
8
1234​
NIGONIGO
9
1234​
CashieringNIGO
10
5678​
ReviewIGO
11
5678​
ReviewIGO
12
5678​
Internal ReviewIGO
13
5678​
Internal ReviewIGO
14
5678​
New Account SetupIGO
15
5678​
Tech SetupIGO
16
5678​
New Account SetupIGO
17
5678​
Tech SetupIGO
18
2121​
ReviewIGO
19
2121​
ReviewIGO
20
2121​
Internal ReviewIGO
21
2121​
Internal ReviewIGO
22
2121​
New Account SetupIGO
23
8765​
ReviewNIGO
24
8765​
ReviewNIGO
25
8765​
CashieringNIGO
26
8765​
Tech SetupNIGO
27
8765​
Tech SetupNIGO
28
8765​
CashieringNIGO
29
8765​
NIGONIGO
 
Upvote 0
This formula worked for me. Let me know if this works for your situation!

=IF(COUNTIF(INDIRECT(ADDRESS(MATCH(A2,$A$1:$A$29,0),2,4,1)&":"&ADDRESS(MATCH(A2,$A$1:$A$29,1),2,4,1,)),"NIGO")>0,"NIGO","IGO")
 
Upvote 0
Solution
This formula worked for me. Let me know if this works for your situation!

=IF(COUNTIF(INDIRECT(ADDRESS(MATCH(A2,$A$1:$A$29,0),2,4,1)&":"&ADDRESS(MATCH(A2,$A$1:$A$29,1),2,4,1,)),"NIGO")>0,"NIGO","IGO")
This does work thank you very much.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,642
Members
452,663
Latest member
MEMEH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top