SOLVED

Vlookup and Countif formula - Help

Copper Contributor

I have a worksheet that I use vLookup in to look up the company and then the product and it puts an X.  Now I need it to look up the company, as well has the product and calculate how many of that product. 

Example below is the Company 1, 2, and 3 have 2 products and Company 4 has 1 product. 

 

This is the formula I use currently that puts an X if the company has the product, I have tried to incorporate the countif in the formula however I either get errors, N/A, or X.  

 

=IF(ISERROR(VLOOKUP($A2312&AJ$3,'Billable Products'!$H$3:$H$13000,1,0)),"","X")

Excelling5_0-1629908864870.png

 

Excelling5_1-1629908873770.png

 

4 Replies

@Excelling5 

 

The formula you post has nothing in it about counting...

 

And the images are not any where near as helpful as the actual spreadsheet. Is it possible for you to post even this mockup, making sure that it is an accurate representation of your actual? Ideally, unless there's confidential info that you're not at liberty to share, post the real spreadsheet.

@mathetes  Thank you for the feedback, it is a confidential info and the report itself is massive with many tabs and different formulas.  I was trying to share as much as I could without posting the actual sheet.   That is correct the formula I have now works for what I needed it to do, however, there was a change that we now need to count how many of this one particular product, at this time the vlookup goes to the tab, pulls the information by customer and product and puts an X in saying they have this product.  I need this on the other 50 products and only on 1 product do I need to count it.  I have been trying to use the vlookup with the countif statements however, I am getting errors.  I was looking to see if someone out there has used the vlookup and countif in a formula together and how they may have gotten it to work.   

best response confirmed by allyreckerman (Microsoft)
Solution

@Excelling5 

 

It truly is hard to give specific help without seeing the specific layout(s) of your workbook(s).

 

I've used the various COUNT functions recently with the FILTER function nested in it to select the rows to be counted. The latter is very new and requires the most recent version of Excel, but if you have it, it can be far more powerful than VLOOKUP. You could also try XLOOKUP.

 

Here's a reference that explains FILTER and a couple of other equally powerful and complementary functions. https://www.youtube.com/watch?v=9I9DtFOVPIg

 

By the way, your reference to multiple tabs concerns me. There are many times when we see posted here sample files where multiple tabs are used to represent, say, different customers or vendors, and the products associated. Excel works VERY well--you might say it excels--when such data, albeit for different customers or vendors or products, are ALL arrayed on a single sheet, in a single table, with columnar identifiers used to designate the customer or vendor or product (whatever it was that supposedly warranted its own sheet).

 

So that too could be part of a solution: consider consolidating those multiple tabs into a single database. You might be astounded at how much simpler you've made your task when you let Excel do the "heavy lifting" rather than trying to "help" by separating those entities out.

@mathetes
Thank you for the reference and assistance. I appreciate it!!! I will review this and see if I can get it to work.

Thank you!!!
1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@Excelling5 

 

It truly is hard to give specific help without seeing the specific layout(s) of your workbook(s).

 

I've used the various COUNT functions recently with the FILTER function nested in it to select the rows to be counted. The latter is very new and requires the most recent version of Excel, but if you have it, it can be far more powerful than VLOOKUP. You could also try XLOOKUP.

 

Here's a reference that explains FILTER and a couple of other equally powerful and complementary functions. https://www.youtube.com/watch?v=9I9DtFOVPIg

 

By the way, your reference to multiple tabs concerns me. There are many times when we see posted here sample files where multiple tabs are used to represent, say, different customers or vendors, and the products associated. Excel works VERY well--you might say it excels--when such data, albeit for different customers or vendors or products, are ALL arrayed on a single sheet, in a single table, with columnar identifiers used to designate the customer or vendor or product (whatever it was that supposedly warranted its own sheet).

 

So that too could be part of a solution: consider consolidating those multiple tabs into a single database. You might be astounded at how much simpler you've made your task when you let Excel do the "heavy lifting" rather than trying to "help" by separating those entities out.

View solution in original post