formula to return difference in values

it's an excel world

Board Regular
Joined
Sep 17, 2008
Messages
126
Hello all,

I have a file that I need to pull back the difference in values in one column based on the values in a different column.

I have order numbers running down column A and the number of days it took to ship the each line on the orders in column B. So I may have order number ABC listed ten times down column A, but various numbers ranging from 1 - 20 running down column B on the same rows as order number ABC. I need a formula to identify the smallest number in column B for that particular order number in column A and return a zero. Then any number with a higher value than the smallest number would return the difference between that number and the smallest value.

Example: Rows 1-2 for order ABC, column B for rows 1-2 are 3 and 6. I would like a 0 to be returned for the 3 and a 3 for the 6.

I have dozens of order numbers running down column A, but only want to look at the number in column B for the within the same order number.


Thanks in advance!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello all,

I have a file that I need to pull back the difference in values in one column based on the values in a different column.

I have order numbers running down column A and the number of days it took to ship the each line on the orders in column B. So I may have order number ABC listed ten times down column A, but various numbers ranging from 1 - 20 running down column B on the same rows as order number ABC. I need a formula to identify the smallest number in column B for that particular order number in column A and return a zero. Then any number with a higher value than the smallest number would return the difference between that number and the smallest value.

Example: Rows 1-2 for order ABC, column B for rows 1-2 are 3 and 6. I would like a 0 to be returned for the 3 and a 3 for the 6.

I have dozens of order numbers running down column A, but only want to look at the number in column B for the within the same order number.


Thanks in advance!
Maybe this...

Book1
ABC
2ABC30
3ABC63
4DEF10
5DEF87
6DEF179
7GHI20
8JKL50
9JKL50
10JKL61
Sheet1

Enter 0 in C2.

Enter this formula in C3 and copy down as needed:

=IF(A3=A2,B3-B2,0)
 
Upvote 0
Took me a little longer but

=IF(A2<>A1,0,B2-MIN(IF($A$2:$A$10=$A2,$B$2:$B$10,FALSE)))

entered as an array formula (Ctrl+Shift+Enter)
does the same job
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,278
Members
452,902
Latest member
Knuddeluff

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