Function to only perform up to last value

Drivingman

New Member
Joined
Jan 26, 2012
Messages
19
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
HI All
Hoping you can help me sort this out. I thought I had it but not working how I want it.

I have a formula that I am changing daily to include one extra cell in the formula.

=((SUM(Daily!BL10:bt10)-SUM(Daily!BL4:bt4))/SUM(Daily!BL4:bt4))

The range is all the way up to CP4 or CP10.

The blank values are what is in row 10. So currently BL10-BT10 all have values in, and tomorrow etc extra cells will have values in.
I cant just use the full range as next weeks values are already in row 4, so the result is lower than actual.

I had thought the following would work, but alas not.

=((SUMIF(Daily!BL10:CP10,"<>",Daily!BL10:CP10)-SUMIF(Daily!BL10:CP10,"<>",Daily!BL4:CP4))/SUMIF(Daily!BL10:CP10,"<>",Daily!BL4:CP4))


Thanks for your help.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
BL is the start of the month and BT is the cell we are currently in. The month will end on CP so don’t need to go past that column.
Anything that will only do the function up to the last empty cell on row 4.
 
Upvote 0
Assuming row 10 gets filled from the left with no blanks between the numbers (only blanks to the right of the numbers), then try this

=(SUM(BL10:CP10)-SUM(BL4:INDEX(BL4:CP4,COUNT(BL10:CP10))))/SUM(BL4:INDEX(BL4:CP4,COUNT(BL10:CP10)))
 
Upvote 0
.. and the formula I suggested?

If it does need to go on a different sheet and may need to be copied down referencing different rows than row 10 but always referencing row 4, it would be:

=(SUM(Daily!BL10:CP10)-SUM(Daily!BL$4:INDEX(Daily!BL$4:CP$4,COUNT(Daily!BL10:CP10))))/SUM(Daily!BL$4:INDEX(Daily!BL$4:CP$4,COUNT(Daily!BL10:CP10)))
 
Upvote 0
col B
row 301/06/201802/06/201803/06/201804/06/201805/06/201806/06/201807/06/201808/06/201809/06/201810/06/201811/06/201812/06/201813/06/201814/06/201815/06/201816/06/2018
45678910111213141516171819
desired start date05/06/2018
desired end date14/06/2018
total125
=SUMPRODUCT(($B$3:$Q$3>=$H$13)*($B$3:$Q$3<=$H$14)*($B$4:$Q$4))
desired start date05/06/2018
desired end datenewest date
162
=SUMPRODUCT(($B$3:$CZ$3>=$H$23)*($B$3:$CZ$3<=MAX($B$3:$CZ$3))*($B$4:$CZ$4))

<colgroup><col><col><col span="5"><col><col span="9"><col></colgroup><tbody>
</tbody>
 
Upvote 0
Thank you Peter_SSs, that works a dream, and simple enough I can amend for future months too.

 
Upvote 0
Thank you Peter_SSs, that works a dream, and simple enough I can amend for future months too.

You are welcome. :)
But if I understand correctly, you shouldn't need to amend anything in future months. As more values are added in row 10, the formula will automatically include those extra columns.
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,286
Members
449,218
Latest member
Excel Master

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