Solved

DateValue function

Posted on 2013-12-13
6
325 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 80

Expert Comment

by:byundt
Comment Utility
Of course it can.

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

Author Comment

by:Frank Freese
Comment Utility
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 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:Frank Freese
Comment Utility
One question here....would this be an array formula?
0
 
LVL 80

Expert Comment

by:byundt
Comment Utility
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
Comment Utility
I answered my own last question.
Great...two options for one problem.
Thank you very much
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

744 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

16 Experts available now in Live!

Get 1:1 Help Now