Find a value based on two inputs

riskier4ra

Board Regular
Joined
Dec 5, 2017
Messages
101
Hi, I could use some help finding a specific average from two inputs. Not sure if it can be done, but I have been trying to use sumproduct and its not working out very well.

I have a Table setup like so.

B1:M1 = Jan, Feb, Mar, Apr, May, Jun, July, Aug, Sep, Oct, Nov, Dec
A2= Animals
B2:M2 = Various Dollar Amounts (250,300,250,400,300,250,250,300,350,350,300,200)
A3 = Avg
B3:M3 = Averages calculated progressively from month to month (250,275,266.67,300,300,291.67,285.71,287.50,294.44,300,300,291.67)

A5= Dining Out
B5:M5 = Various Dollar Amounts
A6= Avg
B6:M6 = Averages calculated progressively from month to month


In B14 I have text = Month
C14 I Input the month name
In B15 I have a Data Validation List where I can select either Animals or Dining Out
In C15 is where I need a formula to give me the Average that depends on the month and category selected from C14 and B15 respectively.

Thanks for any help,
D
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Make a selection in B15.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B15")) Is Nothing Then Exit Sub
    Dim foundMon As Range
    Dim foundCat As Range
    Set foundCat = Range("A:A").Find(Target, LookIn:=xlValues, lookat:=xlWhole)
    If Not foundCat Is Nothing Then
        Set foundMon = Rows(1).Find(Range("C14"), LookIn:=xlValues, lookat:=xlWhole)
        If Not foundCat Is Nothing Then
            Range("C15") = Cells(foundCat.Row + 1, foundMon.Column)
        End If
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,941
Members
449,480
Latest member
yesitisasport

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