简体   繁体   中英

Excel sumif to match the current hour

I have a table that has hours listed in column B an an expected # of cycles in column D. i need to have it sum the expected cycles for everything up to the current hour in cell D21. I can not for the life of me get it to work. the code i tried is below along with a picture of the table to help understand what i am trying to do.

=SUMIF(B8:B20,"<=HOUR(time())", D8:D20)

在此处输入图片说明

so if it is 10:00 AM the sum in cell D21 should be 24. in the image i just had =sum(D8:D20)

What did i do wrong in my formula that it inst working?

Sorry, this should perhaps best go as a comment, but I don't have that privilege yet. But to get the current hour (in excel 2013 that is) you write:

=SUMIF(B8:B20; "<="&HOUR(NOW());D8:D20) 

Most likey your "1am" is in reality 0.0416666666666667, which is year 0 + 1/24 of a day.

You need to divide your hour( now() ) by 24 before comparing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM