merging formula - assitance

eddster

New Member
Joined
Oct 11, 2017
Messages
25
Mr Excel Query

I currently have two formulas that I am trying to combine sothat the combined formula provides both outputs required

I wonder if anyone could assist on the basis of info provided below

The formal below are the 2 current versions I have in a cell W7 I would like to combine them to achieve both function from the one formula



  1. Formula 1 - this formula takes a value (£) and period (Years)and if they match the Year column [W] it applies the cost into that cell, ifthe frequency is every 5 years i.e. 5 it will then apply the cost in the nextperiod due. i.e. £7,500 in 2019 with a frequency of 5 will apply the £7,500cost into the 2019 column and then the 2024 column.
Where
AL7 = year of work
H7 = frequency
W6 = column year
T7 = work cost value (spread value so total divided by spreadperiod which is a cell S7)

=IF($AL7="",0,IF(AND($H7="N/A",$AL7=W$6),$T7,IFERROR(IF($AL7>W$6,0,((MOD(W$6-$AL7,$H7)=0)*$T7)),0)))




  1. Formula 2 - I also have another formula which works for thiscell W7 which applies a different calculation, in this case the formula looksat the year and costs but also looks at a spread value which then spreads thecost over the period of time stated i.e. if it was 2019 with a spread of 3 itwould apply the value 0ver years 2019/2020/2021
Where
AL7 = year of work
H7 = frequency
W6 = column year
T7 = work cost value (spread value so total divided by spreadperiod)
S7 = smoothing period

=IF(AND(W$6>($AL7-1),W$6<($AL7+$S7)),$T7,0)

Can anyone help me combine the two formulas?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Please can you give us SEVERAL DIFFERENT examples of possible data, showing what the results should be from the combined formula.

Please show AT LEAST TWO DIFFERENT examples where the first version of the formula applies, and AT LEAST TWO MORE DIFFERENT examples where the second version of the formula applies.
 
Upvote 0
Hi Gerald

Please see below hope this helps

I am aware there maybe problems where the smoothing/frequency values may cause an overlap

Desired Output from formula
GHOPQSTWXYZAAABACADAEAFAG AL
6ITEMfrequency (years)Quantityratecostspreadspread cost20192020202120222023202420252026202720282029Year of proposed work
7X11101011010101010101010101010102019
8Y52501001100 100 100 2020
9Z23401201120 120 120 120 120 1202021
10A321530310 10101010101010102022
11AB551005003166.6666667 166.66667166.66667166.66667 166.66667166.666672023
12C61100010005200 2002002002002002002024
Formula 1cellW7 =IF($AL7="",0,IF(AND($H7="N/A",$AL7=W$6),$T7,IFERROR(IF($AL7>W$6,0,((MOD(W$6-$AL7,$H7)=0)*$T7)),0)))
This formula applies the recurring frequency but not the smoothing
GHOPQSTWXYZAAABACADAEAFAG AL
6ITEMfrequency (years)Quantityratecostspreadspread cost20192020202120222023202420252026202720282029Year of proposed work
7X11101011010101010101010101010102019
8Y525010011000100000010000002020
9Z234012011200012001200120012001202021
10A321530310000100010001002022
11AB551005003166.66666670000166.666670000166.6666702023
12C6110001000520000000200000002024
Formula 2CellW7 =IF(AND(W$6>($AL7-1),W$6<($AL7+$S7)),$T7,0)
This formula applies the smoothing but not the recurring frequency works
This formula applies the smoothing but not the recurring frequencyGHOPQSTWXYZAAABACADAEAFAG AL
6ITEMfrequency (years)Quantityratecostspreadspread cost20192020202120222023202420252026202720282029Year of proposed work
7X1110101101000000000002019
8Y5250100110001000000000002020
9Z2340120112000120000000002021
10A321530310000101010000002022
11AB551005003166.66666670000166.66667166.66667166.6666700002023
12C611000100052000000020020020020020002024
<colgroup><col width="64" style="width: 48pt;" span="2"> <col width="112" style="width: 84pt; mso-width-source: userset; mso-width-alt: 4096;"> <col width="64" style="width: 48pt;" span="2"> <col width="122" style="width: 92pt; mso-width-source: userset; mso-width-alt: 4461;"> <col width="64" style="width: 48pt;"> <col width="109" style="width: 82pt; mso-width-source: userset; mso-width-alt: 3986;"> <col width="64" style="width: 48pt; mso-width-source: userset; mso-width-alt: 2340;" span="12"> <col width="129" style="width: 97pt; mso-width-source: userset; mso-width-alt: 4717;"> <tbody> </tbody>
 
Last edited:
Upvote 0
Try this in W7 . . . .

Code:
=IF(W$6>=$AL7,IF($S7=$H7,$T7,IF(MOD(W$6-$AL7,$H7)<$S7,$T7,0)),0)

This appears to deliver the desired results, EXCEPT it returns a 0 for item C in 2029, but based on your logic I THINK that that is actually correct.
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,826
Members
449,190
Latest member
rscraig11

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