Return the intersection value from a matrix in Excel

I would like a formula in Column  Risk Exposure (E4) to return the value from a matrix (RiskExposuretable) based on the intersection of the value in Column (Probability (C4)) and the value in Column (Impact (D4).
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
The attached workbook contains a User Defined Formula called 'Intersection' in cell E4. Note that it's dependent on the sheet's structure. In other words if for example the location of the Risk Exposure Table changes then the UDF will need to be changed.
StevenPMoffatAuthor Commented:
Can you make it reference the "RiskExposureTable" instead of being hard coded to reference to row 18 and column 4 in this line?
Intersection = Cells(I + 18, P + 4)
Wayne Taylor (webtubbs)Commented:
You can use this formula in cell E4...

    =INDEX(RiskExposureTable, MATCH(D4, Impact, 0)+1, MATCH(SUBSTITUTE(C4, "~", "~~"), Probability, 0)+2)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Martin LissOlder than dirtCommented:
Function Intersection(rngP As Range, rngI As Range) As String
Dim lngEntry As Long
Dim I As Integer
Dim P As Integer
Dim rngRET As Range

Set rngRET = Cells.Find(What:="Risk Exposure Table", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False)

For lngEntry = 1 To Range("Impact").Cells(1, 1).Row + Range("Impact").Rows.Count - 1
    If Range("Impact").Cells(lngEntry, 1) = rngI Then
        I = lngEntry
        Exit For
    End If
For lngEntry = 1 To Range("Probability").Cells(1, 1).Row + Range("Probability").Columns.Count - 1
    If Range("Probability").Cells(1, lngEntry) = rngP Then
        P = lngEntry
        Exit For
    End If

Intersection = Cells(I + rngRET.Row + 3, P + rngRET.Column + 1)
End Function

Open in new window

Martin LissOlder than dirtCommented:
BTW aren't at least your pink, 2 and 3, column values backward? In other words under 2, as the Impact increases, shouldn't it go from Manageable to Threatening and not the opposite as you have it?
StevenPMoffatAuthor Commented:
You are right, the risk values are backwards, that I leave that up to the author.
StevenPMoffatAuthor Commented:
Both options were acceptable and I thank you for the feedback.
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.