Index/Match/Offset query

vaughan198

New Member
Joined
Oct 10, 2017
Messages
4
Hi,
I am doing a project that I'm struggling with a bit. I wondered if someone could help?
I have one table which contains calculated data that I want to apply categories to another table.


[TABLE="width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Industry[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Energy[/TD]
[TD]25[/TD]
[TD]40[/TD]
[TD]50[/TD]
[/TR]
[TR]
[TD]Retail[/TD]
[TD]20[/TD]
[TD]57[/TD]
[TD]55[/TD]
[/TR]
[TR]
[TD]Chemicals[/TD]
[TD]15[/TD]
[TD]25[/TD]
[TD]50[/TD]
[/TR]
</tbody>[/TABLE]


So on my other table I would like to categorize my data according to the table above.

If the industry matches the industry in column A I would like the score in the other table to be categorized using the criteria above (1,2 or 3).

I am struggling how to get it to do that.

Thanks very much.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi, welcome to the board.

I think I understand roughly what you want to do, but not exactly.

Can you give us maybe 2 or 3 different examples, with what the results should be in each case, and why ?
 
Upvote 0
So we have the table above on one sheet.
On another sheet we have the main data table with 800 or so rows.

[TABLE="width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Name[/TD]
[TD]Industry[/TD]
[TD]Score[/TD]
[TD]Lookup Category[/TD]
[/TR]
[TR]
[TD]XYZ[/TD]
[TD]Energy[/TD]
[TD]42[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABC[/TD]
[TD]Retail[/TD]
[TD]22[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TRY[/TD]
[TD]Chemicals[/TD]
[TD]16[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
and what I want to do is use the other table to populate column D from the other table using the score in column in C
 
Upvote 0
So if you look at my post number 3.
Cell D2 should display "2". Because Industry is "Energy" and "Score" is "42"
same with the other rows.
Thanks so much.
 
Upvote 0
Hi im new to excel and doing macros in vba, I just need some help in filtering out files by the latest created or modified dates. I basically want to count files in certain directory, which I have done but I want to be able to filter out depending on date created/modified. Hope somebody could help, Thank you in advance much appreciated :)

The code below just counts the number of files in a certain directory/folder.

Option Compare Text
Option Explicit

Function CountFiles(Directory As String) As Double
'Function purpose: To count all files in a directory
Dim fso As Object, _
objFiles As Object

'Create objects to get a count of files in the directory
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set objFiles = fso.GetFolder(Directory).Files
If Err.Number <> 0 Then
CountFiles = 0
Else
CountFiles = objFiles.Count
End If
On Error GoTo 0
End Function

Sub TestCount()
'To demonstrate the use of the CountFiles function
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.folderexists(Selection) Then
MsgBox "I found " & CountFiles(Selection) & " files in " & Selection, _
vbOKOnly + vbInformation, CountFiles(Selection) & " files found!"
Else
MsgBox "Sorry, but I can't find the folder: " & vbCrLf & Selection _
& vbCrLf & "Please select a cell that has a valid" & vbCrLf & _
"folder name in it!", vbOKOnly + vbCritical, "Error!"
End If

End Sub
 
Upvote 0
Cell D2 should display "2". Because Industry is "Energy" and "Score" is "42"

Hi, something like this maybe:


Excel 2013/2016
ABCD
1NameIndustryScoreLookup Category
2XYZEnergy422
3ABCRetail221
4TRYChemicals161
Sheet1
Cell Formulas
RangeFormula
D2=LOOKUP(C2,INDEX(Sheet2!$B$2:$D$4,MATCH(B2,Sheet2!$A$2:$A$4,0),0),Sheet2!$B$1:$D$1)



Excel 2013/2016
ABCD
1Industry123
2Energy254050
3Retail205755
4Chemicals152550
Sheet2
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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