# Quantity in column D based on order amount of times the order no appears

1. ## Quantity in column D based on order amount of times the order no appears

Hi,

In the attached file I have the order number in column A and if it appears once then I would like the VBA to place a 1 in column D, but if it appears more than once then I would like the amount of times it appears in column D.

Hope this makes sense and thanks for any help,

David

2. ## Re: Quantity in column D based on order amount of times the order no appears

Use Pivot Table.

3. ## Re: Quantity in column D based on order amount of times the order no appears

I would like to use VBA because it will be part of a larger VBA project.

4. ## Re: Quantity in column D based on order amount of times the order no appears

This is a trivial problem to solve with a formula. Using VBA really doesn't make any sense. Put this formula in D2 and then copy down:

=COUNTIF(A:A,A2)

Just because there is VBA used for something else doesn't mean this has to be VBA.

5. ## Re: Quantity in column D based on order amount of times the order no appears

Maybe:

``Please Login or Register  to view this content.``

6. ## Re: Quantity in column D based on order amount of times the order no appears

Thanks John, that's great.

7. ## Re: Quantity in column D based on order amount of times the order no appears

You're welcome. Glad to help out.

8. ## Re: Quantity in column D based on order amount of times the order no appears

This one lets Excel do the heavy lifting.

``Please Login or Register  to view this content.``

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1