I'll show an alternative way to the array function. That should work just fine, but it is calculation-intensive because it looks at all values in both criteria columns to find what you're looking for. For a few hundred rows this is fine, but if you are using hundreds of thousands of rows then you may see performance issues. Array functions can be expensive.
The first thing I would do is make a helper column that combines the Charge number and Description fields into one field on Sheet1. This will be the value you look up to get the information you want from Sheet1. In order to use VLOOKUP this would need to be the left-most column in the table you are looking up into (the table in sheet1). Then I use a VLOOKUP formula on Sheet2 to retrieve the relevant information from Sheet1.
- On Sheet1, right-click the column A header and select Insert (this will add a new column to the left)
- In this new column A, type the formula
=CONCATENATE(B2,C2) (assuming your data starts on the second row, accounting for headers in the first row. If not use =CONCATENATE(B1,C1)). This will combine the values from columns B and C.
- On Sheet2, enter the following formula into whichever cell you want to display the Line Number from Sheet1:
=VLOOKUP(CONCATENATE(A2,D2),Sheet1!$A:$D,2,FALSE) and fill this formula down
If you want you can hide that column we made in step 1 by right clicking the column header and then Hide.
Now, for an explanation of the magic (VLOOKUP):
The first argument is the value that you want to find. In this case, we want to find the combined charge number + description because those are the values in our helper column we created.
The second argument is saying "Look in Sheet1, columns A through D". This is the table containing information that you want to look up and retrieve from.
The third argument says "If there is a match in column A (remember this is our helper column that we made by combining charge number + description) then return the value in the second column from the left"
The final argument of FALSE means find me an exact match to the value I am looking up, not an approximate one.
There is a step-by-step illustration of this method that may come in handy as well.