IF function

greenfortyguy

New Member
Joined
Sep 7, 2017
Messages
13
Hello,

I am trying to use the IF function to perform a calculation. I will try to outline the scenario below.

A sheet called 'Outputs' has monthly data, running from Sep-17 in cell T36 to Aug-27 in cell EI36.

Another sheet called 'Analysis', in which the formula is going, has the same monthly range but needs to return a value every 3 months (a sum of the 3 months in the 'Outputs' sheet). The first of these 3-month sums will be in cell V64 (Nov-17) of the 'Analysis' sheet. The second will be in Y64, the third in AB64 etc.

For cell V64 in 'Analysis', I am looking for a formula that will ask:

If the SUM(Outputs!T36:V36) is less than 40,000,000, multiply 40,000,000 by a constant (e.g. A1). If the SUM(Outputs!T36:V36) is greater than 40,000,000, multiply SUM(Outputs!T36:V36) minus 40,000,000 by another constant (e.g A2).


For cells Y64, AB64 and onwards, it is a little more complicated. For cell Y64, I am then looking for a formula that will ask:

If the SUM(Outputs!T36:Y36) is less than 40,000,000, multiply 40,000,000 by A1. If the SUM(Outputs!T36:Y36) is greater than 40,000,000, multiply the SUM(Outputs!W36:Y36) minus 40,000,000 by A2.


For clarity, cell AB64 would be:

If the SUM(Outputs!T36:AB36) is less than 40,000,000, multiply 40,000,000 by A1. If the SUM(Outputs!T36:AB36) is greater than 40,000,000, multiply the SUM(Outputs!Z36:AB36) minus 40,000,000 by A2.


Apologies for the length of this post. I hope I have been clear enough for somebody to help. If there was a way I could enter this formula in the first cell and drag to populate the other cells (perhaps using OFFSET?) that would be great.

Many thanks,

Guy
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
this solution with helper rows 3 & 4.
copy E3 to E5 across, formula in E4 taking the advantage of a empty cell in B4, otherwise need amend to work.

row 1 is your monthly data and row 2 at 3 months interval. your required calculations in row 5.


Excel 2013/2016
ABCDEFGHIJKLMN
125,000,0005,000,0002,500,0002,500,0005,000,0005,000,0005,000,0005,000,0005,000,0005,000,0002,500,0002,500,000
2412,500,00012,500,00015,000,00010,000,000
312,500,00025,000,00040,000,00050,000,000
412,500,00037,500,00065,000,00090,000,000
580,000,00080,000,000100,000,000200,000,000
Sheet1
Cell Formulas
RangeFormula
E3=IF(E2="","",SUM($E$2:E2))
E4=IF(E3="","",SUM(B3:E3))
E5=IFERROR(IF(E3<40000000,40000000*$A$1,(E4-40000000)*$A$2),"")
 
Last edited:
Upvote 0
Hi Alan,

Thank you very much for this clear response.

Perhaps as a follow up question, how can I get rid of the #VALUE error occurring in some cells as a result of this formula:

=MIN(IF(T39>40000000,T36,""), IF(T39>40000000, T39-40000000))

I am assuming it is the ("") that is giving the MIN function a problem. Is there a way around this?

Many thanks for your help,
 
Upvote 0
you can try to trap that with the iferror() function like this

=iferror(MIN(IF(T39>40000000,T36,""), IF(T39>40000000, T39-40000000)),"")

or replace the "" with 0

=MIN(IF(T39>40000000,T36,0), IF(T39>40000000, T39-40000000))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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