Vlookup or Sumif

Rupert Bennett

Active Member
Joined
Nov 20, 2002
Messages
271
Please help me with a formula, or VBA if necessary, to lookup a name in column"D" of a summary sheet, find that name in column "C" of a table on another page called "BenefitsUsed" and sum any data for that name in Column "E" of this sheet, if the date entered in column "D" of this sheet is for the current year. A name may be entered more than once on this sheet and the date entered in column "D" may be any year in the past.
A copy of a worksheet that is representative of the data on the BenefitsUsed sheet is attached. Thanks for the help you always give.
Rupert
Vacation Schedule2.xls
CDEF
7NamesDatesVacationHrsPersonalHrs
8Doe,john1/15/2005248
9Mouse,Mickey1/18/2005408
10Poppins,Mary1/8/2005328
11White,Snow7/15/2004408
12Doe,john8/2/2004168
13Mouse,Mickey3/16/2004248
14Poppins,Mary11/15/2004328
15White,Snow1/12/2005408
16Doe,john7/25/2003408
17Doe,john1/8/2005168
18Mouse,Mickey11/20/2003248
19Poppins,Mary10/24/2003408
20White,Snow10/23/2003408
21White,Snow1/3/2005408
22Poppins,Mary1/22/2005168
23Mouse,Mickey1/12/2005408
BenefitsUsed
 
cgreen said:
Hi All, I'm trying to do almost the same thing and am having no luck playing with the formula. Hope you can help. :unsure:

=IF(B5>0,IF(MATCH($A$1,'[Copy of Document Register.xls]Production Control'!$B$2:$B$1001,0),SUMPRODUCT(--('[Copy of Document Register.xls]Production Control'!$C$2:$C$1001=B5),('[Copy of Document Register.xls]Production Control'!$J$2:$J$1001)),0))

The month I am working on is in A1. I want it to look at A1 then go to the 'copy of document register' and look at column B to see if it matches A1. If column B from 'copy of document register' matches A1, I want it to look at B5 and match to column C on the 'copy of document register' and total up the numbers in column (D-E) of the 'copy of document register'.

How do I paste a picture of my spreadsheet to be able to explain more??
 
Upvote 0

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Sorry, I didn't mean to quote the question about bringing my spreadsheet over. It is attached above ... thanks for the info :biggrin:
 
Upvote 0
Hi,

Is this what you want to do? I had to change some of the PCN references as in your example none were the same on both sheets so there was no match!!!

Here's my first sheet:
Copy of Document Register.xls
ABCDEFGHIJ
1Jan-05
2ProgramsDatabaseDocumentRegister
3PCN'sforFY05NameTypeAuth.TotalsMonthSchdRequiredMonthSchdOrderedTotalOrdered
41N01JQ0T700EngOCMI050
52N02JQ0T700EngRecapA32004
63N01BCZT701CEngOCMI0100
74N02BCZT701CEngConvC2503
85N01STKT701CEngRecapA32200
PC Count Report for FY05



Formula in J4 copied down is : =SUMPRODUCT(--('Production Control'!$B$2:$B$6=$A$1),(--('Production Control'!$C$2:$C$6=B4)),('Production Control'!$D$2:$D$6))-SUMPRODUCT(--('Production Control'!$B$2:$B$6=$A$1),(--('Production Control'!$C$2:$C$6=B4)),('Production Control'!$E$2:$E$6))

It would be much better if you could combine your columns D & E to give a net total as that would halve the length of the formula, unless Aladin gives you a better one anyway. HTH
 
Upvote 0
Here's my second sheet so you can see which PCN references I changed:
Copy of Document Register.xls
BCDE
1"Orders" MonthofSchedulePCNQTYOrderedQtyReturned
2Jan-05N02JQ04
3Jan-05N02BCZ52
4Jan-05N02MF54
5Dec-04N01STH1
6Dec-04N01STK1
Production Control
 
Upvote 0
Fergus said:
Hi,

Is this what you want to do? I had to change some of the PCN references as in your example none were the same on both sheets so there was no match!!!

...

Formula in J4 copied down is : =SUMPRODUCT(--('Production Control'!$B$2:$B$6=$A$1),(--('Production Control'!$C$2:$C$6=B4)),('Production Control'!$D$2:$D$6))-SUMPRODUCT(--('Production Control'!$B$2:$B$6=$A$1),(--('Production Control'!$C$2:$C$6=B4)),('Production Control'!$E$2:$E$6))

It would be much better if you could combine your columns D & E to give a net total as that would halve the length of the formula, unless Aladin gives you a better one anyway. HTH

You can make of this a single SumProduct formula...

=SUMPRODUCT(--('Production Control'!$B$2:$B$6=$A$1),--('Production Control'!$C$2:$C$6=B4),('Production Control'!$D$2:$D$6-'Production Control'!$E$2:$E$6))
 
Upvote 0
Thanks Aladin,

I was sure you'd improve it if you saw it. We all learn something from you every day. (y)
 
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top