lookup item number with operation

lochem

New Member
Joined
Jun 14, 2010
Messages
28
Hi,
Ive seen similar posts but cant find what i need to do:

i have a database with many fields, "item number" is in column A and "amount in stock" is column N.

item numbers are repeated often in column A and are unsorted.
for each item appearance, i need to deduct -1 into "amount in stock" from the last time any item appeared.
i need the code to perform the following:
For example the result should be:

Item Num Amount in Stock
10802 21
10301 20
10203 17
10301 19
10502 15
10203 16
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
hmm.. can you please explain your function? so i can appropriately apply it where necessary

thanks!
 
Upvote 0
If A2 is the fist occurrence of itself in column A, B2 is used, otherwise the first matching value above is used, with 1 deducted.

Actually, i just reread your post. My formula won't work for more than 2 occurences.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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