# Formula to add up quantities depending on number of weeks

1. ## Formula to add up quantities depending on number of weeks

Hi all.

I've been fighting with an Excel file all day and I am in need of help. I attache a simplified version of the file.

There are 3 main factors: the number of weeks (displayed in Sheet 1), the quantity for each week (displayed in Sheet 2) and the number of the project.
If the number of weeks needed is 4, then it must add up 4 columns from Sheet 2. If the number is 10, then it must add up 10 columns, and so on. So far, I've come up with the following formula:

=SUM(OFFSET('Sheet2'!,\$A\$3:\$A\$31,0,1,1,\$B25))

Now, I want to match the number in the PN column with the one in Sheet 2 and as a result, obtain the sum that goes with each PN number. And here is where I request some help. I've tried with some VLOOKUP but I wasn't able to get anything.

Thank you in advance.

2. ## Re: Formula to add up quantities depending on number of weeks

in F6

=SUM(OFFSET('Sheet 2'!\$A\$2,MATCH(\$A6,'Sheet 2'!\$A\$3:\$A\$31,0),1,1,\$B6))

copy down

3. ## Re: Formula to add up quantities depending on number of weeks

Thank you so much for your help John!!

##### Users Browsing this Thread

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