I want to do a vlookup/sumif based on dates How can I do it? I saw from a source I have to first change it into numbers Somehow I cannot do it with formulas like value/Datevalue, I can only convert it by changing its format.
Spreadsheet image
CodePudding user response:
The vlookup()
and sumif()
functions work fine with dates and date time values.
With vlookup()
, you can get an exact match of a date time value by setting the is_sorted
parameter to false
. To match the first value that is less than or equal to a date time, make sure that the data range is sorted, and set that parameter to true
.
With sumif()
, if you need to remove the time component from a date time value to match dates to date times, use datevalue()
.
See this answer for an explanation of how dates and times work in spreadsheets.