Can I sum or countif a criteria that is the numerical part of a LEFT('string')?

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
596
Office Version
  1. 2010
Platform
  1. Windows
Does that even make sense? I'll elaborate...

I want to countif on some criteria, where the criteria range is a list of numbers that represent the lead time of a product booking (where departure is the 20th Feb and book date is the 10th Feb, that's a lead time of 10).

So the criteria range is set, it's just numbers, but the criteria I'm selecting from says "1 week from departure", "2 weeks from departure", "3 weeks from departure" in a list.

What I need to do is basically criteria = left, search " week", which returns 1, then multiply that by 7 so that gives me the number of days, and then determine whether the booking (10 day lead time) falls within 1 week of departure or 2 weeks. As 10 is greater than 7, it goes within 2 weeks..


Is this possible to do in one formula? Lol. Cheers!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
596
Office Version
  1. 2010
Platform
  1. Windows
The answer is "yes"

Excel Formula:
=COUNTIFS('LeadTimes.csv'!$AA:$AA,"<="&LEFT(A15,FIND(" ",A15)-1)*7,'LEadTimes.csv'!$AA:$AA,">"&LEFT(A14,FIND(" ",A14)-1)*7)

So using left on finding the first space gives you the 1, or 2, or 10 or however many weeks, this leaves you with a number but formatted as text, which is annoying. Thankfully for this, multiplying by 7 to get the week converts it to a number without a helper column, and from there I say where it's equal to or less than the current row, but greater than the row below (so equal to or less than 8 weeks = 56 days, but greater than 7 weeks = 49 days, then this would count for a lead time of 52 days...
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,130,169
Messages
5,640,547
Members
417,151
Latest member
ChickenTenderer

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
Top