Forum Discussion
peterpeter1780
Nov 20, 2022Copper Contributor
excel formula help please
I need to get this formula to work to calculate the hours worked
I am wanting the last column to read the lower of the previous 2
or 37.5 if the previous one is greater
1
51.50 | 1 | 37.50 | 45.50 | 37.50 |
31.00 | 0 | 37.50 | 31.00 | 37.50 |
31.00 | 0 | 37.50 | 31.00 | 7.50 |
6 Replies
Sort By
- Riny_van_EekelenPlatinum Contributor
peterpeter1780 Don't follow the logic for the last row in your example, but it's probably a typo. Try this:
Though it seems to be a meaningless formula as the result will always be 37.50
- peterpeter1780Copper ContributorI am trying to if b is 45.5 then it need to return 37.5 in row 2 its 31 so c needs to show 31 and not 37.5
- PeterBartholomew1Silver Contributor
Sorry, but I have difficulty understanding what any of your number repressent or what you are trying to calculate. Also, it would be interesting to know what version of Excel you are using.
With anything after 2007, the data should probably be within a Table and simple formulas would be written to the Table. For example
StandardHrs = MIN([@nominal],[@actual]) AdditionalHrs = [@actual]-[@standard]
With 365, the calculation becomes more demanding, but the result applies to the entire table and is dynamic
= LET( standard, MAP(nominal, actual, LAMBDA(x,y, MIN(x,y))), additional, actual - standard, HSTACK(standard, additional) )