Is there a way to create a vlookup that brings in something only one time per order #?

jloosen

New Member
Joined
Apr 17, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have a report that I want to vlookup the Dept based on the PCAT. This is where it gets complicated...There are multiple lines on each order and I only want it to bring in the Dept on one line of the order and preferably the lowest line number of the order. I had come up with =IF(COUNTIF(A:A,A2)=1,VLOOKUP(C2,J:K,2,FALSE),IF(B2=1,VLOOKUP(C2,J:K,2,FALSE),"")) which almost works but not every order has a line 1 such as order 1909896-00. Do you have any ideas on how this can be done? My end goal is to do a sumif of miles per dept but I don't want to count the # of miles per order multiple times.
1713372620488.png
 

Attachments

  • 1713371769594.png
    1713371769594.png
    48 KB · Views: 5

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Like this?

Mappe6
ABCDEFG
1OrderLinePCATIDDept
2G106042 
3G46000 
4G86010 
5G16010Golf Irrig
6G26000 
7B36010 
8B25128 
9B19000Xmas
10W46010 
11W76042 
12W99000 
13W35128Res/Com
Tabelle1
Cell Formulas
RangeFormula
G2:G13G2=IF(A2&MINIFS($B$2:$B$13,$A$2:$A$13,A2)=A2&B2,XLOOKUP(C2,$J$2:$J$6,$K$2:$K$6),"")
 
Upvote 0
Solution
Like this?

Mappe6
ABCDEFG
1OrderLinePCATIDDept
2G106042 
3G46000 
4G86010 
5G16010Golf Irrig
6G26000 
7B36010 
8B25128 
9B19000Xmas
10W46010 
11W76042 
12W99000 
13W35128Res/Com
Tabelle1
Cell Formulas
RangeFormula
G2:G13G2=IF(A2&MINIFS($B$2:$B$13,$A$2:$A$13,A2)=A2&B2,XLOOKUP(C2,$J$2:$J$6,$K$2:$K$6),"")
That worked. Thank you so much! It was driving me crazy.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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