Lucky_Irishman
New Member
- Joined
- Feb 19, 2022
- Messages
- 8
- Office Version
- 365
- Platform
- Windows
Error in UDF using application.worksheetfunction and structured reference in a table.
Compile Error:
Expected: Expression
The object is to replace the complex formula in the "Carrier" column with a UDF.
I'm having trouble with the syntax of this part. I don't need help replicating the entire formula in VBA.
Thanks in advance for your help.
Compile Error:
Expected: Expression
The object is to replace the complex formula in the "Carrier" column with a UDF.
I'm having trouble with the syntax of this part. I don't need help replicating the entire formula in VBA.
Thanks in advance for your help.
VBA Code:
Function Carrier()
' UDF using application.worksheetfunction and structured reference in a table
' Compile Error:
' Expected: Expression
Dim strInput
Dim strOutput
strInput = "usps"
strOutput = "USPS"
Carrier = Application.WorksheetFunction.IFERROR(IF(FIND(strInput, [@[Tracking Link]])<>0,strOutput),"")
End Function
Orders_test.xlsm | |||||
---|---|---|---|---|---|
A | B | C | |||
1 | Item | Tracking Link | Carrier | ||
2 | Item 1 | https://www.fedex.com/apps/fedextrack/ | Fedex | ||
3 | Item 2 | https://www.amazon.com/progress-tracker/ | Amazon | ||
4 | Item 3 | https://wwwapps.ups.com/etracking/ | UPS | ||
5 | Item 4 | https://www.pochta.ru/ | Russian Post | ||
6 | Item 5 | http://www.dhl-usa.com/ | DHL | ||
7 | Item 6 | http://link.order.homedepot.com/ | Home Depot Express Delivery | ||
8 | Item 7 | https://www.sf-international.com/ | SF-International | ||
9 | Item 8 | https://www.yuntrack.com/ | YunExpress | ||
10 | Item 9 | https://tools.usps.com/ | USPS | ||
Order Tracking |
Cell Formulas | ||
---|---|---|
Range | Formula | |
C2:C10 | C2 | =IF([@[Tracking Link]]="", "",IFERROR(IF(FIND("homedepot", [@[Tracking Link]])<>0,"Home Depot Express Delivery" ),IFERROR(IF(FIND("fedex", [@[Tracking Link]])<>0,"Fedex"),IFERROR(IF(FIND("usps", [@[Tracking Link]])<>0,"USPS" ), IFERROR(IF(FIND("amazon", [@[Tracking Link]])<>0,"Amazon" ),IFERROR( IF( FIND("ups", [@[Tracking Link]])<>0, "UPS"),IFERROR( IF(FIND("canadapost", [@[Tracking Link]])<>0,"Canada Post"),IFERROR(IF(FIND("dhl", [@[Tracking Link]])<>0,"DHL"),IFERROR(IF(FIND("sf-international", [@[Tracking Link]])<>0,"SF-International"),IFERROR(IF(FIND("Pickup", [@[Tracking Link]])<>0,"Pickup" ),IFERROR( IF(FIND("yuntrack", [@[Tracking Link]])<>0,"YunExpress"),IFERROR(IF(FIND("pochta", [@[Tracking Link]])<>0, "Russian Post"),"" )))))))))))) |