Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-01-2024, 04:10 AM
ksor ksor is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2016
Advanced Beginner
I need a formula to do this !!!!
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default I need a formula to do this !!!!

I have a "daily" reporting of a temperature - "daily", yeah, but sometimes I forget it and maybe do the reporting after 2-3 days.




I have to calculate an AVERAGE for each quarter and in fact this average temp.value is what I need to report.


I have made a sample sheet and want ONLY the GREEN columns - the red columns is only here in the sample sheet to illustrate what I mean.


Sorry for the DANISH function names just use translating list for Excel funcions !



When I ENTER the DATE and the TEMP for that day, I want the formula to calculate the AVERAGE TEMP for the QUARTER until "now" (=the date I entered !)
Attached Files
File Type: xlsx TEST.xlsx (10.9 KB, 9 views)
Reply With Quote
  #2  
Old 01-01-2024, 04:44 PM
June7's Avatar
June7 June7 is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2010
Novice
 
Join Date: Nov 2023
Posts: 20
June7 is on a distinguished road
Default

What's wrong with the calc you have? If the Wanted is giving you what you want, what needs to change?

Could use AVERAGEIF but would need to include year in Quarter calculation.

=YEAR(A2) & ROUNDUP(MONTH(A2)/3,0)

Then use that in AVERAGEIF.

=AVERAGEIF($B$2:$B$34,"=" & B2,$C$2:$C$34)

If you want to extract year/quarter from date value for use in formula without having to calculate in a column, sorry, don't know that. Every example I find shows using helper column.
Reply With Quote
  #3  
Old 01-02-2024, 01:29 AM
ksor ksor is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2016
Advanced Beginner
I need a formula to do this !!!!
 
Join Date: Feb 2018
Location: Århus V, Denmark
Posts: 74
ksor is on a distinguished road
Default

#June7


In fact there will ONLY be entered temps for a single year, and then the formula you gave will do the job !


THX !
Reply With Quote
  #4  
Old 01-02-2024, 08:57 AM
p45cal's Avatar
p45cal p45cal is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2021
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Takes into account year and quarter, in cell D2:
Code:
=AVERAGE(IF(((YEAR($A$2:$A$34)=YEAR(A2))*($B$2:$B$34=B2))<>0,$C$2:$C$34))
copied down.
Reply With Quote
  #5  
Old 01-02-2024, 02:55 PM
June7's Avatar
June7 June7 is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2010
Novice
 
Join Date: Nov 2023
Posts: 20
June7 is on a distinguished road
Default

p45Cal, I tried your formula and just returns same result for all quarters which is the average of all rows.
Reply With Quote
  #6  
Old 01-02-2024, 03:31 PM
p45cal's Avatar
p45cal p45cal is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2021
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Not at a computer at the moment, but I did this in MSOffice 365, so try entering the formula in a single cell with Ctrl+Shift+Enter (array-entering), and then copy down.
Edit: At computer now:
2024-01-02_224709.jpg
Reply With Quote
  #7  
Old 01-02-2024, 03:50 PM
June7's Avatar
June7 June7 is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2010
Novice
 
Join Date: Nov 2023
Posts: 20
June7 is on a distinguished road
Default

That was it. I am still using Office 2010. Works with my year/quarter calc but when I change back to the original version just calculating quarter, results for quarter 4 are wrong because the sample data crosses calendar years and includes two quarter 4 periods.

However, this still requires the 'helper' calculated column so not really seeing advantage.
Reply With Quote
  #8  
Old 01-02-2024, 07:06 PM
p45cal's Avatar
p45cal p45cal is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2021
Expert
 
Join Date: Apr 2014
Posts: 871
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Quote:
Originally Posted by June7 View Post
However, this still requires the 'helper' calculated column so not really seeing advantage.
True; hadn't read the question!
In the attached, column C contains longish formula which should work in Excel 2010:
Code:
=AVERAGE(IF(((YEAR($A$2:$A$34)=YEAR(A2))*(ROUNDUP(MONTH($A$2:$A$34)/3,0)=ROUNDUP(MONTH(A2)/3,0)))<>0,$B$2:$B$34))
In column D, since it seems the OP's Excel version will work with lambda formulae, a short formula:
Code:
=QuarterAvg($A$2:$A$34,$B$2:$B$34,A2)
with hints:

2024-01-03_020723.jpg


In column E, for interest only, the derivation of that lambda formula, the long:
Code:
=LAMBDA(dates,temps,oneDate,LET(qtrs,YEAR(dates)&"|"&ROUNDUP(MONTH(dates)/3,0),oneQtr,YEAR(oneDate)&"|"&ROUNDUP(MONTH(oneDate)/3,0),AVERAGE(IF(qtrs=oneQtr,temps))))($A$2:$A$34,$B$2:$B$34,A2)
For cross checking, a pivot table at cell G1.
Attached Files
File Type: xlsx msofficeforums51858TEST.xlsx (18.6 KB, 3 views)
Reply With Quote
  #9  
Old 01-02-2024, 10:11 PM
June7's Avatar
June7 June7 is offline I need a formula to do this !!!! Windows 10 I need a formula to do this !!!! Office 2010
Novice
 
Join Date: Nov 2023
Posts: 20
June7 is on a distinguished road
Default

Looks like you deleted Column B so C moved to become B. With that in mind, I made adjustment and the new formula works with Ctrl+Shift+Enter.
Reply With Quote
  #10  
Old 01-03-2024, 12:55 AM
ArviLaanemets ArviLaanemets is offline I need a formula to do this !!!! Windows 8 I need a formula to do this !!!! Office 2016
Expert
 
Join Date: May 2017
Posts: 873
ArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud ofArviLaanemets has much to be proud of
Default

Here is a formula which works with any Excel version from ~15 latest years, and don't need Ctrl+Shift+Enter.

This formula don't work without quarter column. And I had to add an additional pair of checks to avoid Q4 from 2023 counted into Q4 from 2024.

The only way to avoid using quarter column is probably go even more back, and instead SUMIFS and COUNTIFS to use SUMPRODUCT, where instead of column values you could check expressions for those columns! But I think, keeping the quarter column (and hide it) is easier way.
Attached Files
File Type: xlsx TEST (3).xlsx (11.4 KB, 2 views)
Reply With Quote
Reply

Tags
excel 2013 formula



Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Copy Row 2 Row But Next Column In Formula From Another Tab TimG Excel 3 04-16-2018 09:20 PM
I need a formula to do this !!!! Formula Help OTPM Excel 2 10-22-2017 06:38 AM
I need a formula to do this !!!! Possible to use an existing vlookup formula to also insert correct info and trigger a SUM formula innkeeper9 Excel 2 09-13-2016 08:59 PM
Need help with dragging a formula and changing a reference column as I drag the formula. LupeB Excel 1 10-22-2015 03:02 PM
I need a formula to do this !!!! Need help with formula zachluke Excel 3 03-13-2014 11:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft