Equation to find % difference change of data within the same column

Liliquestionsxlxs

New Member
Joined
Mar 2, 2022
Messages
17
Office Version
  1. 2021
Platform
  1. Windows
Capturexlsxquestion.JPG


I need an equation that would find the percent difference of the Ratio column that uses the step name and batch ID as the differentiators.

For example:
% Difference = ((Baseline 2 of Batch 23 - Baseline 1 of Batch 23)/Baseline 1 of Batch 23) =0.245109893
% Difference = ((Ratio 2 of Batch 23 - Ratio 1 of Batch 23)/Ratio 1 of Batch 23) = 0.196243382
% Difference = ((Ratio 2 V/A of Batch 23 - Ratio 1 V/A of Batch 23)/Ratio 1 V/A of Batch 23) = -0.238607548

I would like to have Excel be able to differentiate between each batch ID and using the same batch ID and corresponding step names before doing the calculation. I keep on doing this by hand and would like to not do that anymore.

I want to avoid having to separate all the data into two or more columns to calculate the % difference so no I do not want to create a separate. I would like to be able to have Excel do that calculation automatically and be able to use that same equation on thousands of rows.

I tried this equation but it's adding the data of all the columns so it's not doing what I want it to do.

=IF(LEFT(B3,7)<>"Ratio","",IF(MID(B3,7,1)="1",SUMIFS(C:C,A:A,A3,B:B,B3)-SUMIFS(C:C,A:A,A3,B:B,"Ratio 2"&RIGHT(B3,LEN(B3)-7)),SUMIFS(C:C,A:A,A3,B:B,B3)-SUMIFS(C:C,A:A,A3,B:B,"Ratio 1"&RIGHT(B3,LEN(B3)-7))))
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Welcome to the Forum!

Here's one way that might work for you:

ABCD
1BatchStepRatio% Diff
223Baseline 119-32%
323Baseline 213 
423Ratio 118-28%
523Ratio 1 V/A15+7%
623Ratio 213 
723Ratio 2 V/A16 
852Ratio 218 
952Ratio 2 V/A13 
1052Baseline 112+58%
1152Baseline 219 
1252Ratio 110+80%
1352Ratio 1 V/A17-24%
1486Ratio 117-41%
1586Ratio 1 V/A17+6%
1686Ratio 210 
1786Ratio 2 V/A18 
1886Baseline 115-20%
1986Baseline 212 
Sheet1
Cell Formulas
RangeFormula
D2:D19D2=IF(ISERR(SEARCH(" 1",B2)),"",INDEX(C$2:C$19,MATCH(1,(A$2:A$19=A2)*(B$2:B$19=SUBSTITUTE(B2,"1","2")),))/C2-1)
 
Upvote 0
... it works for the very first reading but not the following readings
You should just need to adjust the final row number in the formula:

ABCD
1BatchStepRatio% Diff
223Baseline 119-32%
323Baseline 213 
423Ratio 118-28%
523Ratio 1 V/A15+7%
623Ratio 213 
723Ratio 2 V/A16 
852Ratio 218 
952Ratio 2 V/A13 
1052Baseline 112+58%
1152Baseline 219 
1252Ratio 110+80%
1352Ratio 1 V/A17-24%
1486Ratio 117-41%
1586Ratio 1 V/A17+6%
1686Ratio 210 
1786Ratio 2 V/A18 
1886Baseline 115-20%
1986Baseline 212 
201Blah 112+67%
211Blah 220 
221More blah 1 blah11+64%
231Something 1 else15+27%
241More blah 2 blah18 
254Something 2 else18 
262Blah 117+6%
272Blah 218 
282More blah 1 blah18-
292Something 1 else13-23%
302More blah 2 blah18 
312Something 2 else10 
323Blah 118-17%
333Blah 215 
343More blah 1 blah20-50%
353Something 1 else12+17%
363More blah 2 blah10 
373Something 2 else14 
384Blah 120-
394Blah 220 
404More blah 1 blah19-16%
414Something 1 else10+80%
424More blah 2 blah16 
431Something 2 else19 
Sheet3
Cell Formulas
RangeFormula
D2:D43D2=IF(ISERR(SEARCH(" 1",B2)),"",INDEX(C$2:C$43,MATCH(1,(A$2:A$43=A2)*(B$2:B$43=SUBSTITUTE(B2,"1","2")),))/C2-1)
 
Upvote 0
Fortunately the first formula works and it is the column at the very end in bold. It looks like the first formula only considers one filter which would be the batch number but I just noticed that in my larger file I also filtering the data using a section number as in the picture. I guess the question here is can this formula be edited to have a second filter? Something along the lines of adding that?

=IF(ISERR(SEARCH(" 1",B2)),"",INDEX(C$2:C$19,MATCH(1,(A$2:A$19=A2, B$2:B$19=B2)*(B$2:B$19=SUBSTITUTE(B2,"1","2")),))/C2-1)
 

Attachments

  • Capturexlsxquestion1.JPG
    Capturexlsxquestion1.JPG
    121.3 KB · Views: 6
Upvote 0
I guess the question here is can this formula be edited to have a second filter? Something along the lines of adding that?
=IF(ISERR(SEARCH(" 1",B2)),"",INDEX(C$2:C$19,MATCH(1,(A$2:A$19=A2, B$2:B$19=B2)*(B$2:B$19=SUBSTITUTE(B2,"1","2")),))/C2-1)
Close! Try:

ABCDE
1BatchSectionStepRatio% Diff
2231Baseline 119-32%
3231Baseline 213 
4231Ratio 118-28%
5231Ratio 1 V/A15+7%
6231Ratio 213 
7231Ratio 2 V/A16 
8232Baseline 112+8%
9232Baseline 213 
10232Ratio 114+21%
11232Ratio 1 V/A10+50%
12232Ratio 217 
13232Ratio 2 V/A15 
14523Ratio 218 
15523Ratio 2 V/A13 
16523Baseline 112+58%
17523Baseline 219 
18523Ratio 110+80%
19523Ratio 1 V/A17-24%
20524Ratio 117-41%
21524Ratio 1 V/A17+6%
22524Ratio 210 
23524Ratio 2 V/A18 
24524Baseline 115-20%
25524Baseline 212 
Sheet1
Cell Formulas
RangeFormula
E2:E25E2=IF(ISERR(SEARCH(" 1",C2)),"",INDEX(D$2:D$25,MATCH(1,(A$2:A$25=A2)*(B$2:B$25=B2)*(C$2:C$25=SUBSTITUTE(C2,"1","2")),))/D2-1)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,515
Messages
6,119,973
Members
448,933
Latest member
Bluedbw

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