Formula Query

motherboard85

New Member
Joined
Feb 27, 2024
Messages
5
Office Version
  1. 2019
Hi i have a dataset of utility consumption with dates down the left and time in 30 min increments along the top. Im looking for a formula than can tell me the highest consumption but also what time of that day it occurred

1709059730805.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
There may be more concise formulas, but this seems to work:

Excel Formula:
=INDEX($A$2:$Z$11,
SUM(($A$2:$Z$11=MAX($A$2:$Z$11))*(ROW($A$15:$A$24)-ROW(A14))),
SUM(($A$2:$Z$11=MAX($A$2:$Z$11))*(COLUMN($A$13:$Z$13))))
 
Upvote 0
There may be more concise formulas, but this seems to work:

Excel Formula:
=INDEX($A$2:$Z$11,
SUM(($A$2:$Z$11=MAX($A$2:$Z$11))*(ROW($A$15:$A$24)-ROW(A14))),
SUM(($A$2:$Z$11=MAX($A$2:$Z$11))*(COLUMN($A$13:$Z$13))))
Hi Can this apply to one line at a time?
 
Upvote 0
I didn't read your question that way. Are you asking for a new column that tells you what hour of each line had the highest usage?
 
Upvote 0
Hi & welcome to MrExcel.
Another option
Fluff.xlsm
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAHAIAJAKALAMANAOAPAQARASATAUAVAWAXAY
100:0000:3001:0001:3002:0002:3003:0003:3004:0004:3005:0005:3006:0006:3007:0007:3008:0008:3009:0009:3010:0010:3011:0011:3012:0012:3013:0013:3014:0014:3015:0015:3016:0016:3017:0017:3018:0018:3019:0019:3020:0020:3021:0021:3022:0022:3023:0023:30
210/02/2024293.5710.8312.8448.75287.4045.39255.1279.72278.96197.21167.43248.2018.00101.698.8919.1324.73117.8399.43120.23283.03211.86237.58297.10171.03247.3710.56242.04137.76101.8754.27164.2748.9865.16288.0431.65268.11251.21197.9493.73120.2419.1931.7527.4762.57119.4898.04159.02297.1011:30:00
311/02/2024286.4789.32251.70266.15163.62268.01268.70122.9318.1943.536.57218.8586.2765.12103.74287.91115.54264.03271.55209.07155.12148.49249.4246.61226.30296.2416.98158.0958.5778.17110.28179.25264.84298.0038.03229.5624.77299.87144.17114.2218.26266.17209.59258.56192.48186.49151.9869.50299.8718:30:00
412/02/2024148.43120.24114.51175.5029.2869.5758.94220.94135.40235.6874.47206.17153.2934.6869.94294.0326.2539.52198.1526.75204.0730.58244.90288.2873.32158.9976.03136.2134.04108.96215.33297.62200.17143.13135.72126.61281.08151.7988.68172.16101.3588.27185.59214.0515.88197.80178.29204.97297.6215:30:00
513/02/2024224.91130.25107.29170.3081.9773.70187.39181.55143.28265.52210.58148.41175.8134.46245.37210.3755.69126.6578.3111.53284.151.09223.21173.4091.51268.94192.47126.0934.3237.45154.42245.98275.90251.7234.18101.3157.70125.7549.6228.48125.9094.51210.8257.68245.91241.7432.77277.58284.1510:00:00
614/02/202488.09190.6085.95152.7871.5343.26211.1924.0727.69251.46173.3283.47250.74131.18188.94152.19268.8099.08296.36230.6052.45137.2418.50157.3232.7790.96215.7396.70183.76249.46209.1593.93201.13176.5326.92110.74181.28288.08176.69235.2797.64297.0137.9137.1958.35222.40151.82141.61297.0120:30:00
715/02/2024128.998.0148.90210.81151.8976.3527.7412.90101.033.4573.12281.3951.36272.08202.7972.42264.2480.1054.52234.55152.895.17164.68286.33252.88239.80126.88253.52217.6415.9863.066.38252.5363.8434.30182.3541.47135.3548.06169.3076.42143.85284.16154.15298.6071.74193.51154.72298.6022:00:00
816/02/2024190.78296.98108.2453.31202.47221.35206.6257.32185.9058.65256.2617.40213.286.394.62123.6799.76115.20251.57213.7763.85245.64291.41219.286.77112.43269.6865.15252.7587.07289.03286.4427.17217.69188.1955.5871.48224.46239.15210.10129.20114.93239.77171.04115.80100.39284.43103.11296.9800:30:00
917/02/2024140.92115.8367.63293.08275.18296.23257.6081.8448.98294.89147.58209.37224.44281.5128.12286.34160.35277.572.32159.94221.68286.64200.71103.63181.5996.00239.64284.05205.63281.1622.0771.5367.6899.85220.4166.47230.90225.081.31136.1842.63157.97208.6439.18282.77118.41126.21161.86296.2302:30:00
Data
Cell Formulas
RangeFormula
AX2:AX9AX2=MAX(B2:AW2)
AY2:AY9AY2=INDEX($B$1:$AW$1,,MATCH(AX2,B2:AW2,0))
 
Upvote 0
And yet another option is to use Power Query
Load the table into the PQ editor and determine the max value per day
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type date}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Column1"}, "Attribute", "Value"),
#"Grouped Rows" = Table.Group(#"Unpivoted Other Columns", {"Column1"}, {{"Max", each List.Max([Value]), type number}})
in
#"Grouped Rows"
Power Query:

Join the original query result on the original table and filter for the time

Power Query:
let
    Source = Table.NestedJoin(Table1, {"Column1", "Max"}, #"Table1 (2)", {"Column1", "Value"}, "Table1 (2)", JoinKind.LeftOuter),
    #"Expanded Table1 (2)" = Table.ExpandTableColumn(Source, "Table1 (2)", {"Attribute"}, {"Attribute"}),
    #"Filtered Rows" = Table.SelectRows(#"Expanded Table1 (2)", each not Text.Contains([Attribute], "Column"))
in
    #"Filtered Rows"
Book1
ABC
11Column1MaxAttribute
122/10/2024297.103779311:30:00 AM
132/11/2024299.87475666:30:00 PM
142/12/2024297.61998263:30:00 PM
152/13/2024284.149750810:00:00 AM
162/14/2024297.01427258:30:00 PM
172/15/2024298.60177210:00:00 PM
182/16/2024296.977404812:30:00 AM
192/17/2024296.22687542:30:00 AM
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,078
Messages
6,122,997
Members
449,093
Latest member
masterms

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top