Cumbersome formula

Excellis

New Member
Joined
Oct 30, 2012
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
I have created an embedded IF formula to take care of several possible but slightly different results, the formula works but it looks clumsy & cumbersome and my not even be the right way to do it. If any one can help tidy it up I'd be extremely grateful. I've tried to anonymise my example by using similar data to the actual data.


A typical shop code might be 014 Newtown or 626 Oldtown

=IF(LEFT(H11,3)*1>144,"sto"&LEFT(H11,3)*1&"x@myshop.com",IF(LEFT(H11,3)*1<10,"stor00"&LEFT(H11,3)*1&"x@myshop.com",IF(LEFT(H11,3)*1>99,"stor"&LEFT(H11,3)*1&"x@myshop.com","stor"&0&LEFT(H11,3)*1&"x@myshop.com")))

A typical shop code might be 014 Newtown or 626 Oldtown

What I'm trying to achieve is this:


Any shop that has a reference code 001 to 009 I want to see (example) stor004x@myshop.com
Any shop that has a reference code 010 to 099 I want to see (example) stor064x@myshop.com
Any shop that has a reference code 100 to 144 I want to see (example) stor110x@myshop.com
Any shop that has a reference code >144 I want to see (example) sto540@myshop.com

I'm sorry but I don't know how to attach an example spreadsheet.

Thank you in anticipation

Tom
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also is that last example correct or should it be stor540x@myshop.com
 
Upvote 0
If the last example is wrong, how about
Excel Formula:
="stor"&LEFT(H11,3)&"x@myhop.com"
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Also is that last example correct or should it be stor540x@myshop.com
Thank you, I'll do that. I'm using Excel 2016, and my example sto540 is correct. Any shops over number 144 drop the 'x' and the 'r' in the email address.
 
Last edited:
Upvote 0
Ok how about
Excel Formula:
="stor"&LEFT(H11,3)&IF(LEFT(H11,3)+0>144,"","x")&"@myshop.com"
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0
Your formula seems to be ok like this. If you want a short hand, make a simple table like this in another sheet. Let say Sheet2:
Column A
Column B
Column C
001009stor004x@myshop.com
010099stor064x@myshop.com
100144stor110x@myshop.com
145sto540@myshop.com

Your formula can be simple as this:
Excel Formula:
=VLOOKUP(LEFT(H11,3), 'Sheet2'!$A$1:$C$4, 3, 1)
Thank you for your suggestion. I did consider using something similar but this is a weekly report and it would mean recreating or copy/pasting the table weekly whereas I can 'hide' the formula in the report and it's just there to paste into every line. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,215,409
Messages
6,124,733
Members
449,185
Latest member
hopkinsr

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