Using VLOOKUP to calculate the sum of specific dates

Drewmyster

Board Regular
Joined
May 16, 2007
Messages
151
Office Version
  1. 365
Platform
  1. Windows
I’m never great at explaining these things, but the simple requirement is to look up a date that matches the date in column A (A2 for example) and calculate the sum of all cells in column B (for example) for each row that relates to that date (located in column A on another sheet) which the formula has looked up.

How is this done please?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
SUMIF()

=SUMIF( Sheet2!A2:A1000 , A2, Sheet2!B2:B1000)

=SUMIF ( The range to look for the date , the date to lookfor, the range to add up where it matches in the same row as the date )
 
Upvote 0
Solution
It sounds like maybe you can use a SUMIF or SUMIFS formula (you use these formulas to sum up values that meet a certain criteria).
See:

If this not appear to do what you want, or you are having issues getting it to work, please post a sample of your data and expected results.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Thank you for this reply.

This has solved my question, but it has prompted a side one which you may be able to help with to complete my spreadsheet…

Having now achieved all the daily figures using the formula shared above, I now want to calculate the total sum of values for a month from daily figures.

Column A has the dates for October, column B has the sum value from each day.

Sheet2 has the months listed in column A and I want to input a formula in column B to total the sum of everything calculated in the original sheet for each day for the month of October.

Can someone please show me how this is done? I appreciate the support.
 
Upvote 0
depending in how the data is laid out & if they are real dates
then a SUMIFS() with

And use the date as criteria
so
=SUMIFS(B1:B13,A1:A13,">="&"1/10/21",A1:A13,"<="&"31/10/21")
But you may want to code the dates based on the months in column A - but not sure how your data looks

Book1
ABCD
11-Oct-211
22-Oct-21291
33-Oct-213
44-Oct-214
55-Oct-215
66-Oct-216
77-Oct-217
88-Oct-218
99-Oct-219
1010-Oct-2110
1111-Oct-2111
1212-Oct-2112
1313-Oct-2113
Sheet5
Cell Formulas
RangeFormula
D2D2=SUMIFS(B1:B13,A1:A13,">="&"1/10/21",A1:A13,"<="&"31/10/21")


OR
=SUMIFS(B1:B13,A1:A13,">="&D2,A1:A13,"<="&EOMONTH(D2,0))
where the date in D2 is 1st of month ie 1/10/21 and formatted to show just the month & year

Book1
ABCDE
11-Oct-211
22-Oct-212Oct/202155
33-Oct-213Nov/202136
44-Oct-214
55-Oct-215
66-Oct-216
77-Oct-217
88-Oct-218
99-Oct-219
1010-Oct-2110
1111-Nov-2111
1212-Nov-2112
1313-Nov-2113
Sheet5
Cell Formulas
RangeFormula
E2:E3E2=SUMIFS(B1:B13,A1:A13,">="&D2,A1:A13,"<="&EOMONTH(D2,0))
 
Upvote 0
Hello again, sorry to revisit this thread after the helpful replies before…

I had been successfully using this formula last month to work out my figures;

=IF(SUMIF(A:A,L1,F;F)=0,"",SUMIF(A:A,L1,F:F))

This correctly returned the sum value of figures matching todays date (as shown in L1).

Now however, I have replaced numbers in column F with words “Yes” and “No”

I want the formula to count the number of cells in column F, which match the date in column A with L1, which return the word “Yes”

Please show me how to do this.

Thank You.
 
Upvote 0
Try using COUNTIF instead of SUMIF.
It is structured exactly the same. See: COUNTIF function

I will let you take a run at it, as it will be a good exercise to help make sure you have a firm understanding of how these formulas work.
Post back with your formula attempt if you run into issues.
 
Upvote 0
Try using COUNTIF instead of SUMIF.
It is structured exactly the same. See: COUNTIF function

I will let you take a run at it, as it will be a good exercise to help make sure you have a firm understanding of how these formulas work.
Post back with your formula attempt if you run into issues.
I understand the logic of what this formula does, but I can't work out how to add a criteria so it knows only to search the cells that have a match with the current date in L1.

Does the formula still need to begin with =IF(COUNTIF(..... or does it need to have something else.
 
Upvote 0
If you need to match on multiple fields (i.e. "Date" and "Yes"), then you can use COUNTIFS, which allow for multiple criteria.
See: COUNTIFS function
 
Upvote 0

Forum statistics

Threads
1,225,968
Messages
6,188,097
Members
453,461
Latest member
Cjohnson3

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