# If Statement with Text as a range of Values and Numbers needed as Output

#### Xifajk

##### New Member
Hey guys and girls,

I found this website via Google trying to solve a problem I'm trying to solve with Excel 2010, so I decided to make an account and post my problem here as it seems a friendly community. I have the following list (showing part of it):

 Name T-Shirt Sizes Nathan S Rachelle XL Anton XL Graziella XS Christine S

<colgroup><col><col><col></colgroup><tbody>
</tbody>

The aim of the list is to see what Sizes each and every person needs and then count how many T-Shirts are required for that particular size. The list is over a 100 entries long so counting it manually isn't really an option as it's time consuming as well as errors might arise.

Thus, I've been trying to use the IF statement with the following logic but to as no avail

IF Size in Column is XS
Add 1 to a particular Cell
IF Size in Colum is S
Add 1 to a particular Different Cell

and so on for the other sizes...kind of like a counter for a for-do-loop.

Any help is appreciated, especially if I'm using the wrong function!

Thanks and regards!

### Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

#### Pcool

##### Board Regular
I would use the countif function in the cell you want to display the total of each different size =COUNTIF(A1:A100,"S")

#### etaf

##### Well-known Member
Column A has all the names
Column B has all the sizes people have ordered

assume starting at row2

put all the possible sizes into a new column say D

so D2 down - has

S
M
L
XL
XXL
XXXL
and any other possible size

Now in column E2 next to the Size put

i have assumes list is to row 1000
=COUNTIF(\$B\$2:\$B\$1000,D2)
and copy down for all rows with the unique sizes in

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

1,167,942
Messages
5,856,428
Members
431,813
Latest member
seconduser

### 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.

### Which adblocker are you using?

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

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