subtraction formula that skips rows with no data

csliger931

New Member
Joined
Jul 22, 2020
Messages
21
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi,

I am needing some help with a formula. I have a spreadsheet containing rows of information representing when data is collected. On certain days, there is no data collected, so the rows for those days are blank. I need a formula that will subtract today's value from the most previous value regardless of when that most previous value occurred. What I do NOT want is a formula that simply references the previous row, since that row may not have any data. See the example table below for my situation. I need a formula that can go in the top-right of the example table that will recognize that there is no data on 05/31 or 05/30, so instead it subtracts from the data on 05/29.
Does anyone know how to do this? I would greatly appreciate any help I can get from you Excel wizards.
Thanks!
Chris
NOTE: MY VALUES DON'T ALWAYS GO IN ASCENDING ORDER, SO I CAN'T SIMPLY HAVE A FORMULA THAT SCANS FOR THE LARGEST VALUE AND SUBTRACTS FROM THAT. IT NEEDS TO RECOGNIZE EMPTY ROWS AND SKIP THEM UNTIL IT GETS TO A DAY WHERE THERE WAS DATA.

06/01/2259=(59-47)/(06/01-05/29) = (12)/(3) = 4
05/31/22
05/30/22
05/29/2247=(47-41)/(05/29-05/27) = (6)/(2) = 3
05/28/22
05/27/2241
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
With Excel 365 and a gap of no more than 10 (which can easily be raised):

Book1
ABC
1DateValueFormula
26/1/2022594
35/31/2022 
45/30/2022 
55/29/2022473
65/28/2022 
75/27/202241#CALC!
Sheet12
Cell Formulas
RangeFormula
C2:C7C2=IF(B2<>"",LET(f,FILTER(A3:B10,B3:B10<>""),(B2-INDEX(f,1,2))/(A2-INDEX(f,1,1))),"")
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
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