Formula for manipulating temperature ranges difference

damon_l

New Member
Joined
Jul 13, 2017
Messages
25
Good Day,

I'm busy with quite a complex energy savings engineering calculation in Excel.

I have two columns with temperature ranges.

I want to a develop a formula that will say if the difference between the two temperature ranges is less than 2 then leave the value as is and if not then subtract a specific amount so the result will be a difference of 2 then populate a new cell with whatever that value was that was deleted.

An example to show what I'm looking for.

Assume column A has a temp of 70 F and Column B has a temp of 78, by having Column C subtract the two values to get the difference in this instance the difference is 8. I need to subtract 6 from the 8 to get a 2 but I also wish to populate another cell with the 6 as I need this value for the 2nd part of the calculation. The end result will be a different value for each cell inputted as these temperature ranges fluctuate.

Is there a way to automate this as a I have few thousand cells to go through with the same calculation.

Maybe there's an easier way to go about the above?

Thanks
Regards
Damon
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Excel Workbook
ABC
5Value to be 2 difference
670786
770786
885785
970786
1070653
1170786
12701949
13708816
14708513
1570786
Sheet2
 
Upvote 0
Temperatures in A1 and B1

in C1
=ABS(A1-B1)

in D1
=IF(ABS(A1-B1)<2,0,MAX(A1,B1)-MIN(A1,B1)-2)

C1 is the difference between the two temparatures
D1 is either the difference minus 2 (in your example 6) or 0 if the difference is less than 2.
 
Upvote 0
I don't know if the sign of the difference is significant.

Does this help?

[TABLE="class: grid"]
<tbody>[TR]
[TD]°1[/TD]
[TD]°2[/TD]
[TD]Diff set to <=2[/TD]
[TD]Diff If[/TD]
[/TR]
[TR]
[TD="align: right"]70[/TD]
[TD="align: right"]78[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]8[/TD]
[/TR]
[TR]
[TD="align: right"]76[/TD]
[TD="align: right"]71[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD="align: right"]72[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]70[/TD]
[TD="align: right"]72[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
[TR]
[TD="align: right"]70[/TD]
[TD="align: right"]70[/TD]
[TD="align: right"]0[/TD]
[TD="align: right"]0[/TD]
[/TR]
</tbody>[/TABLE]

Formula in C2:
=(ABS(B2-A2)>=2)*(ABS(B2-A2)-2)

Formula in D2:
=(ABS(B2-A2)>=2)*ABS(B2-A2)
 
Last edited:
Upvote 0
Thanks Wayne, that formula works.

I can now use the output of column C to work out the next part of the equation!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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