Solved

DateValue function

Posted on 2013-12-13
6
327 Views
Last Modified: 2013-12-14
Folks,
Can the DATEVALUE function reference a cell address such as A3 rather than be hard coded?
0
Comment
Question by:Frank Freese
  • 3
  • 3
6 Comments
 
LVL 81

Expert Comment

by:byundt
ID: 39718234
Of course it can.

What data does the cell contain in your workbook that DATEVALUE cannot convert?
0
 

Author Comment

by:Frank Freese
ID: 39718253
Let's say A3:A40 are dates: 11/01/2013 - 11/30/2013
In cell C2 I would like to enter in a date: 11/15/2013
In cells B3:B40 are various product numbers many repeated for some products might have more sales during this time period.
In cell D2 I enter in a product number: K7896
F2 will tell me how many of a product I sold in that day.
I tried to do this in F2:
{=SUM((DATEVALUE(Range("C2"))=$A$3:$A$40)*(Range("D2")=$B$3:$B$40)}

I get a #VALUE error in F2

I know I could use filters but I'm trying to do this with a formula.
0
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39718260
Your problem is with Range("C2"). This is VBA syntax, and does not work in a worksheet formula. The worksheet equivalent is INDIRECT("C2").

What I suggest instead is a regular formula using SUMPRODUCT:
=SUMPRODUCT((C2=$A$3:$A$40)*(D2=$B$3:$B$40))     if C2 is a date formatted like you showed
=SUMPRODUCT((DATEVALUE(C2)=$A$3:$A$40)*(D2=$B$3:$B$40))        if C2 is text
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Frank Freese
ID: 39718781
One question here....would this be an array formula?
0
 
LVL 81

Expert Comment

by:byundt
ID: 39718784
The SUMPRODUCT formula is an array formula that does not need to be array-entered.

If the formula is not working for you, could you please post a sample workbook that demonstrates the problem? It doesn't need more than five rows of data.
0
 

Author Closing Comment

by:Frank Freese
ID: 39718787
I answered my own last question.
Great...two options for one problem.
Thank you very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now