If first columns vlookup is blank then vlookup second column

EVCOdan

New Member
Joined
Aug 30, 2023
Messages
10
Office Version
  1. 2021
Platform
  1. Windows
Hi all,

I'm trying to follow the excel formula below.

=IF(VLOOKUP([@CustomerID],Customer,3)=””,
VLOOKUP([@CustomerID],Customer,4),
VLOOKUP([@CustomerID],Customer,3))


Current formula;

=IF(VLOOKUP((O5706 & "M"),'Routing Data'!A:U,16,FALSE)="",VLOOKUP((A5706 & "M"),'Routing Data'!A:U,16,FALSE)*3600,VLOOKUP((O5706 & "M"),'Routing Data'!A:U,16,FALSE)*3600)

The above formula returns an #N/A value if column O is blank.

I'm not sure if this is being effected by the fact that I'm sourcing the data to the "Routing Data" spreadsheet from another excel file.

I've also tried running the below formula;

=IFNA(IF(VLOOKUP((O5704),'Routing Data'!B:U,15,FALSE)="","",VLOOKUP((O5704&"M"),'Routing Data'!A:U,16,FALSE)*3600),VLOOKUP((A5704&"M"),'Routing Data'!A:U,16,FALSE)*3600)

Both scenarios work, but only in one direction.

Any ideas what I'm doing wrong?
 
That doesn't really tell me anything. Can you post some sample data & explain exactly what you are trying to do.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
That doesn't really tell me anything. Can you post some sample data & explain exactly what you are trying to do.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
Due to IT contraints I cant install the add-in, however I can link the data from the cells.

Item Browse spreadsheet
Ord QtySetup TimeRun TimeYieldRouting CodeSiteProd LineMemo TSerial ControlCustomerMoldStatusBuyer/PlannerDesign GroupPromotion GroupDrawingDrawing LocDrawing SizeAddedDEV BEGINDEV ENDUser IDDEV QTYManufacturing Lead TimeCumulative Lead TimePart Weight (QAD)Cycle TimeRedirect
15360.00260420.006111110041400NeverRW5170ACTos77103-1324460000rwh010104
#N/A​
9400137​

Routing Data spreadsheet
ConcatenateRouting CodeOperationStart DateEnd DateStandard OperationWork CenterMachineYield PercentDescriptionMachines per OperationMilestone OperationSetup CrewRun CrewSetup TimeRun TimeSupplierTool CodeMove Next OperationAuto Labor ReportModified Date
9400136L940013620300LABORL100.00%SETUP & RUN 300-499 TONS1No1.001.001.50.010555555YesNo11/23/2021
9400136M940013630300300M97.00%SETUP & RUN 300-499 TONS1No1.001.001.50.010555555YesNo11/23/2021
9400138L9400138254/28/2020BAL100.00%BASIC ASSEMBLY & SETUP1No1.001.000.50.011111111YesNo4/15/2022
9400138M9400138304/28/2020BAM100.00%BASIC ASSEMBLY & SETUP1Yes1.001.000.50.011111111YesNo4/15/2022

As you can see above 9400137 does not exist on the Routing Data sheet. Therefore I will not be able to pull data from this location.

I've rethought the procedure and based on the data, it would be best to run the formula the way you did original, but if the formula does not find anything on the Routing Data sheet because the item does not exist, then search in Column M for the data on the primary sheet. The reason i say this is because the data in column M on the primary sheet is total data and only applicable if the item is complete without and L event which is seperated by lines on the Routing Data sheet.

So in short first run the below formula (This formula is placed in cell AK on the Item Browse worksheet);

VBA Code:
=LET(v,VLOOKUP(O2 & "M",'Routing Data'!A:P,16,FALSE),IF(IFNA(v,"")="",VLOOKUP(A2 & "M",'Routing Data'!A:P,16,FALSE),v))*3600

If this formula does not find anything, then used value from column M of item browse.


Hope this helps make a better understanding.
 
Upvote 0
Maybe
Excel Formula:
=LET(v,VLOOKUP(O2 & "M",'Routing Data'!A:P,16,FALSE),IF(IFNA(v,"")="",ifna(VLOOKUP(A2 & "M",'Routing Data'!A:P,16,FALSE),M2),v))*3600
 
Upvote 1
Solution
Maybe
Excel Formula:
=LET(v,VLOOKUP(O2 & "M",'Routing Data'!A:P,16,FALSE),IF(IFNA(v,"")="",ifna(VLOOKUP(A2 & "M",'Routing Data'!A:P,16,FALSE),M2),v))*3600
Works like a charm! Thanks!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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