• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code to AverageIF

BCM_85

New Member
Hi,

I am looking VBA code for Purchases average and sales average of a particular product mentioned in the below table.
PRODUCTTYPERATE
APurchase15
BPurchase9
APurchase8
ASale13
BSale13
BPurchase11
APurchase10
BSale11
ASale14

So kindly help me with code if I manually enter "A" then "Purchase" and result should be "Average Rate i.e 11".

Similarly for Sales of A result "Average Rate i.e 13.5".

Thank you.
 
BCM_85
Where will You manually enter those two texts?
Where/how would the result will give?
Could You send a sample Excel-file, which will show Your sample data as well as expected results?
 
BCM_85
Where will You manually enter those two texts?
Where/how would the result will give?
Could You send a sample Excel-file, which will show Your sample data as well as expected results?


Sir,

Thank you for the reply.

Kindly Refer Sheet named "Product_Price". In this sheet, If I enter product in cell B5 the average price of Purchase and Sale of product "B" in the product list should display In C5 and D5 using VBA Macros.


File attached.

Thank you.
 

Attachments

  • Poduct List.xlsm
    18.7 KB · Views: 1
Sir,

Thank you for the workbook, it is useful.

I have attached the sample workbook of my work. In this workbook, if I add any sale or purchase in the Sheet "Product_List" then the average price result should display in the sheet "Product_Price" in C5 and D5 cell if enter manually Product name in B5 Cell.


Thank you.
 

Attachments

  • Poduct List.xlsm
    18.7 KB · Views: 4
BCM_85
Did You notice that Your file is different than You've written in #1?
You could do that without VBA or this way.
 

Attachments

  • Product List.xlsb
    22 KB · Views: 2
Back
Top