Nov 29 2021 05:22 PM
I've got an inventory list in column A of all my meds (about 300). I've got a medication usage list in a different column (say, C) that only has the list of meds that I've dispensed in the last month (about 90). If I can get each of the meds in the C column to appear on the same line as the corresponding drug in column A, I could easily subtract col. C from col. A to get my current inventory. Is there an easy way to do this without cutting and pasting each med from column C to it's correct line in a new column?
Nov 29 2021 10:40 PM
@Robert_Peltzman Hi,
With Excel 365 you can have cell B1
=XLOOKUP(A1;C:C;D:D;"")
being similar to in older versions of Excel, use
=IFERROR(VLOOKUP(A1;C:D;2;0);0)
and in both cases fill down or.
Even better, select in column A an Insert:table. Your formulas will then expand with the number of rows in the table.
Both columns Usage and Out are calculated.
Beware though that if you undo a change in a tables column formula, you may have to undo two or three times to come back to previous state.
Nov 29 2021 10:57 PM - edited Nov 30 2021 12:21 AM
@Robert_Peltzman This would be something for VLOOKUP or XLOOKUP is your Excel version supports it. But, your data seems to be inconsistent. One med on the shorter list does not exist in the long list (marked yellow) and four meds on the short list seem to have different names (marked orange). For instance, "GlipiZIDE 10 mg tablet" vs. "Glipizide 10mg tablet". Either of the lookup functions will not match them. Then you have some double entries in the long list, also causing trouble. "Garbage in, garbage out".
I've reconciled the lists for you (using VLOOKUP as it works for all Excel versions), trusting that it will enable you to clean-up the data yourself.
See attached file.
Nov 30 2021 12:17 AM
Nov 30 2021 12:25 AM
Nov 30 2021 12:37 AM
Nov 30 2021 02:29 AM
Mm... if you have the article numbers, use them instead of the names and you will get better results since it may happen that two different numbers share the same name.
Adjust the formulas to use the numbers;
D2 =IFERROR(VLOOKUP(A2;G:I;3;0);0)
Nov 30 2021 07:56 AM
Nov 30 2021 08:17 AM
Nov 30 2021 08:34 AM
Nov 30 2021 08:38 AM
Nov 30 2021 08:54 AM
I do not have the same national/local settings as you, and have semi colon where your version expects a comma.
Using the attached file should overcome that, or change ; to comma.
The parameter with 3 means column number three in the lookup area. It is though better to start using xlookup. It also has the parameter you refer to by default set to match exactly.
(there seems to be an issue with attaching files - let me know if you need it another way)
Nov 30 2021 09:36 AM