Forum Discussion
CaitlynEXCEL
Jul 30, 2022Copper Contributor
How to subtract from the same user
I know I can just do something like =E4-B6 but is there a way for it to look up by the User ID and subtract the quantities with matching Users?
mathetes
Jul 30, 2022Gold Contributor
I know I can just do something like =E4-B6 but is there a way for it to look up by the User ID and subtract the quantities with matching Users?
Yes. A formula like
=VLOOKUP("KOCEB96[113]",A4:B14,2,0)-VLOOKUP("KOCEB96[235]",D4:E14,2,0)
would return the value -122.
The UserIDs however are not matching (although the first seven characters are), given that they each have different numbers in the square brackets at the end of each ID. It would be a lot cleaner (and easier for a beginner) if you did not have those.
Given that the numbers are embedded in the UserID (in the square brackets), you could also extract that value from the user ID string of text. But the VLOOKUP is the easier way.
Here's a good reference to understand VLOOKUP.