Need help finding a range of text with If statments

birdo91

New Member
Joined
Jan 8, 2018
Messages
1
I'm trying to specify a certain number based off of column G where as anything "ge-0/0/0" through "ge-0/0/23" will return a value and "ge-0/0/24" through "ge-0/0/47" will return a different value.

I was able to figure out how to return a value with this formula: =IF(ISNUMBER(SEARCH("ge-0",G2)),12, IF(ISNUMBER(SEARCH("ge-1",G2)),14,IF(ISNUMBER(SEARCH("ge-2",G2)),16,IF(ISNUMBER(SEARCH("ge-3",G2)),18,IF(ISNUMBER(SEARCH("ge-4",G2)),13,IF(ISNUMBER(SEARCH("ge-5",G2)),20, ""))))))

But i would like to split each "ge-*" into two separate values for being able to calculate cable proper cable lengths. I tried =IF(AND(ISNUMBER(SEARCH("ge-0",G2)),G2>="*0",G2<="*23"),6,"") but it did not return the correct value.

Thanks.
 
Last edited by a moderator:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Welcome to the board!

I recommend first having a look at the CHOOSE function, as I believe your:

Code:
=IF(ISNUMBER(SEARCH("ge-0",G2)),12, IF(ISNUMBER(SEARCH("ge-1",G2)),14,IF(ISNUMBER(SEARCH("ge-2",G2)),16,IF(ISNUMBER(SEARCH("ge-3",G2)),18,IF(ISNUMBER(SEARCH("ge-4",G2)),13,IF(ISNUMBER(SEARCH("ge-5",G2)),20, ""))))))

could be replaced by the much shorter

Code:
=CHOOSE(MID(G2,4,1)+1,12,14,16,18,13,20)

Then, you could replace the "12" with an IF formula for your range criteria.

Perhaps something like this:

Code:
=CHOOSE(MID(G2,4,1)+1,IF(AND(SUBSTITUTE(G2,"ge-0/0/","")+0>0,SUBSTITUTE(G2,"ge-0/0/","")+0<=23),6,12),14,16,18,13,20)
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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