# how to filter or vlookup

Hi All,

I have a spreadsheet which contains lots of items but i want Category 1 items.

what want to do is:

In an order, if Product is more then £150 its a boiler and if it's less then £150 is an accessory.

I want to see how many orders are there in total which have Boilers and out of these orders how many have Boilers +accessories.

Regards,

A
Dreport--2-.xlsx
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertCommented:
Maybe use the COUNTIF or COUNTIFS function.

PS: I'm not sure the identifying product category based on the price is a wise idea.
0
Author Commented:
Thank you Fabrice, but i have category filtered already.

all i want now is If order number has 1 product compare the value if its less then 150£ its accessories so separate that.

else if ordernumber has more then 1 product compare price and if its more then 150£ its a boiler and other product if less then 150 is accessories so this will go in bolier + accessories pot.
0
Commented:
Make a formula on sheet esprit_sale in M2 and copy down
``````=IF(B2<>B1,IF(COUNTIF(B2:B100,B2)=1,IF(J2>=150,"B","A"),IF(COUNTIFS(B2:B100,B2,J2:J100,">=150"),"B+A","A")),"")
``````
Meaning
For each new order number (only calculate once for each order number)
If only one order line and sell price is 150 or more, then it is boiler "B" else it is accessories "A"
Else (more than one order line) if one or more sell prices is 150 or more, it is boiler + accessories "B+A", else all are accessories "A"

Then count the numbers of B, B+A and A, using a countif function.

The orders are sorted, so to speed up the calculation the formula only use a limited number of rows below, instead of using the entire range,

There are 20309 orders
B            5165
B+A            5775
A            9369
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
thank you Eijgil

0
Commented:
I used the sheet esprit_sale where the sell price is, because sales amount on sales is a sum of the prices, so comparing price to 150 could be meaningless.
So it is all orders on sheet esprit_sale.

A similar count on sales, accepting the price problem.
Sorted on OrderNumber and Cat.
Many orders have more than one category, so to only look at Cat 1, and ignore others, the formula is
``````=IF(N2=1,IF(OR(A2<>A1,N1="0"),IF(COUNTIFS(A2:A100,A2,N2:N100,1)=1,IF(B2>=150,"B","A"),IF(COUNTIFS(A2:A100,A2,N2:N100,1,B2:B100,">=150"),"B+A","A")),""),"")
``````

There are 14064 order lines with Cat 1, but only 6614 orders with Cat 1.
B            1572
B+A            2964
A            2078
0
Author Commented:
excellent
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.