kidneythief
New Member
- Joined
- Mar 17, 2021
- Messages
- 34
- Office Version
- 365
- Platform
- Windows
Hi! I'm trying to insert a sheet reference within a countif formula based on the sheet's index number.
My sales sheet (sheet 3) contains a list of items sold in column G. A separate sheet is used per month so the current active sheet would be named APRIL 2021 with the newest, active sheet always being the third from the left.
My invoice sheet (sheet 2) contains a full product list. I'm trying to set up a column here that counts the number of instances of each product list entry that is found in the active sales sheet (always sheet 3).
I've added this module for returning the sheet names:
Function SHEETNAME(number As Long) As String
SHEETNAME = Sheets(number).Name
End Function
Apart from that, I'm having trouble putting together the COUNTIF function (with maybe INDIRECT??) without returning VALUE, NAME, or REF errors.
Any help would be greatly appreciated!
My sales sheet (sheet 3) contains a list of items sold in column G. A separate sheet is used per month so the current active sheet would be named APRIL 2021 with the newest, active sheet always being the third from the left.
My invoice sheet (sheet 2) contains a full product list. I'm trying to set up a column here that counts the number of instances of each product list entry that is found in the active sales sheet (always sheet 3).
I've added this module for returning the sheet names:
Function SHEETNAME(number As Long) As String
SHEETNAME = Sheets(number).Name
End Function
Apart from that, I'm having trouble putting together the COUNTIF function (with maybe INDIRECT??) without returning VALUE, NAME, or REF errors.
Any help would be greatly appreciated!