# VBA - Finding a value, using specific criteria

1. ## VBA - Finding a value, using specific criteria

Hi all,

I'm looking for some help with some code. What I'm trying to do is pretty easy to explain, I'm just not sure what's the most efficient way to do it.

help.xls

I attached an example of two of the worksheets that I would be using. One would have the census information (age, tenure, etc.) The other one is a volume analysis that counts how many people of a certain age there are. None of this I have a problem with, but what I need is an IF statement or something that will say: IF this person is 28, what is their salary? Then it would find their salary and add it to 'Total Salary' (C11 in the uploaded document).

In simple terms: determine how much people at a certain age make in total.

If I need to explain more, I'd love to.

Thanks for any help.

2. ## Re: VBA - Finding a value, using specific criteria

A simple index and match formula on sheeet2

3. ## Re: VBA - Finding a value, using specific criteria

If you want the formula on sheet1 c11. drag it down

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

4. ## Re: VBA - Finding a value, using specific criteria

Works if there is only one count, but for instance, if one of them have multiple counts (which usually happens) it didn't add them.

Sorry, I should have specified a little more clearly - if there were two people at the age 40, who made \$50k and \$30k respectively, it would sum them.

Thanks!

5. ## Re: VBA - Finding a value, using specific criteria

I was a formula person at some point in the past, now my mind is occupied with a code. I am pretty sure others(specially if you go in to the formula section of this site) who are savvy in a formula can easily crack it.

6. ## Re: VBA - Finding a value, using specific criteria

Originally Posted by AB33
I was a formula person at some point in the past, now my mind is occupied with a code. I am pretty sure others(specially if you go in to the formula section of this site) who are savvy in a formula can easily crack it.
No problem Thanks for the direction AB33. Repped

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