Combining 6 IF Formulas to identify freight carrier

Knockoutpie

Board Regular
Joined
Sep 10, 2018
Messages
116
Office Version
  1. 365
Platform
  1. Windows
Hey All,

I've written 6 different IF formulas, each will identify a freight carrier based on the tracking number found in cell BM71.

For the life of me I cannot figure out how to combine these, any help would be appreciated.

=IF(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS", "")
=IF(AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx","")
=IF(AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL","")
=IF(AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion", "")
=IF(AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest", "")
=IF(AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt", "")
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
try this
---------
Excel Formula:
=IFS(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS",AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx",AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL",AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion", AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest",AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt")
 
Upvote 0
Solution
Hey All,

I've written 6 different IF formulas, each will identify a freight carrier based on the tracking number found in cell BM71.

For the life of me I cannot figure out how to combine these, any help would be appreciated.

=IF(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS", "")
=IF(AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx","")
=IF(AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL","")
=IF(AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion", "")
=IF(AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest", "")
=IF(AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt", "")

Can you please share your sample data,

I will try if this can be done in other way.
 
Upvote 0
Another option
Excel Formula:
=IF(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS",IF(AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx",IF(AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL",IF(AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion",IF(AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest",IF(AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt", ""))))))
 
Upvote 0
You might be interested in the following alternative. In some cells that you have available, put a configuration table like the one I show you below.
At the end of the example you can see the formula:


Dante Amor
BMBNBOBPBQBRBS
1NAMELENLEFTISNUMBER
2UPS181ZFALSE
3FedEx12*TRUE
4DHL10*TRUE
5Old Dominio1106FALSE
6Arcbest900FALSE
7Averitt1000FALSE
8Dam7*TRUE
70
711Z-456789012345678UPS
72123456789012FedEx
731234567890DHL
7406-23456789Old Dominio
7500-456789Arcbest
7600-2345678Averitt
77aa-456789012345678Not Exists
781234567Dam
C
Cell Formulas
RangeFormula
BN71:BN78BN71=IFERROR(INDEX($BP$2:$BP$8,SUMPRODUCT(($BQ$2:$BQ$8=LEN(BM71))*(ISNUMBER(SEARCH($BR$2:$BR$8,LEFT(BM71,2))))*($BS$2:$BS$8=ISNUMBER(BM71))*ROW($BP$2:$BP$8))-ROW($BP$2)+1),"Not Exists")
 
Last edited:
Upvote 0
try this
---------
Excel Formula:
=IFS(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS",AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx",AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL",AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion", AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest",AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt")
IFS was my initial approach but I couldn't figure that out so I decide to nest some IF statements, Thank you for this.

Another option
Excel Formula:
=IF(AND(LEN(BM71)=18,LEFT(BM71,2)="1Z"), "UPS",IF(AND(LEN(BM71)=12,ISNUMBER(BM71)),"FedEx",IF(AND(LEN(BM71)=10,ISNUMBER(BM71)),"DHL",IF(AND(LEN(BM71)=11,LEFT(BM71,2)="06"), "Old Dominion",IF(AND(LEN(BM71)=9,LEFT(BM71,2)="00"), "Arcbest",IF(AND(LEN(BM71)=10,LEFT(BM71,2)="00"), "Averitt", ""))))))
This works too, thank you! Always love seeing replies from you.

You might be interested in the following alternative. In some cells that you have available, put a configuration table like the one I show you below.
At the end of the example you can see the formula:


Dante Amor
BMBNBOBPBQBRBS
1NAMELENLEFTISNUMBER
2UPS181ZFALSE
3FedEx12*TRUE
4DHL10*TRUE
5Old Dominio1106FALSE
6Arcbest900FALSE
7Averitt1000FALSE
8Dam7*TRUE
70
711Z-456789012345678UPS
72123456789012FedEx
731234567890DHL
7406-23456789Old Dominio
7500-456789Arcbest
7600-2345678Averitt
77aa-456789012345678Not Exists
781234567Dam
C
Cell Formulas
RangeFormula
BN71:BN78BN71=IFERROR(INDEX($BP$2:$BP$8,SUMPRODUCT(($BQ$2:$BQ$8=LEN(BM71))*(ISNUMBER(SEARCH($BR$2:$BR$8,LEFT(BM71,2))))*($BS$2:$BS$8=ISNUMBER(BM71))*ROW($BP$2:$BP$8))-ROW($BP$2)+1),"Not Exists")
So creative, i'm going to mess around with this, thank you!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,007
Messages
6,122,670
Members
449,091
Latest member
peppernaut

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