Category Formula Help

kiyo052

Board Regular
Joined
Oct 11, 2013
Messages
134
Excel 2010

Is there a way to build a formula for E4, F4, E5, and F5?

My data is going to be in columns A, B, C. Is there a formula that would categorize the data into E and F? Please let me know! Thanks in advance!

ABCDEFG
1
2
3ID number OptionsCategory
41005x7RugsRugs3
51005x8RugsBed2
61005x9Rugs
72005x7Rugs
82005x8Rugs
92005x9Rugs
103005x7Rugs
113005x8Rugs
123005x9Rugs
13400QueenBed
14400KingBed
15400TwinBed
16500FullBed
17500KingBed
18
29

<tbody>
</tbody>
 
Last edited:

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
There seems to be random problems with the formula which is frustrating for me. When I re-did it it worked great!!! Then when I try to add any other data it freaks out. Then when I try pasting the exact data that worked... it didn't work anymore. here is the pic of what happened


2e3uxwo.png



Here is the pic of it working

123nqmt.png


Here is the pic of when I change column A a little bit
21e27hc.png
 
Last edited:
Upvote 0
I am not entirely sure but I think FREQUENCY only works with numbers and not letters.

If that is right, you can fake the format to look like it has "GUC" but the cell value is really only numbers. Would you be okay with that?

You would have to use the custom number format and change for each different ID when required.

Under the custom number format put
"GUC"#
 
Upvote 0
The thing is I'm going to have at least 500 items in my workbook all having different ID numbers and they all have random letters in it. Is there a way to format so that it would be able to read the numbers?

Sorry for the trouble! I really hope you can help!
 
Upvote 0
This only takes into account if the ID has only 4 numbers, you need to adjust the 4 to whatever it is.

Excel 2010
ABCDEFG
4CUG1000RugsRugs3
5CUG1000RugsPillow4
6CUG3000Rugs
7CUG3000Rugs
8CUG2000Rugs
9CUG2000Rugs
10CUG2000Rugs
11ABC3000Pillow
12ABC3000Pillow
13ABC3100Pillow
14ABC3200Pillow
15ABC3300Pillow
16ABC3300Pillow

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Array Formulas
CellFormula
G4{=IF($E4="","",SUM(--(FREQUENCY(IF(CATEGORY=$E4,--RIGHT(ID,4)),IF(CATEGORY=$E4,--RIGHT(ID,4)))>0)))}
G5{=IF($E5="","",SUM(--(FREQUENCY(IF(CATEGORY=$E5,--RIGHT(ID,4)),IF(CATEGORY=$E5,--RIGHT(ID,4)))>0)))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>

Workbook Defined Names
NameRefers To
CATEGORY=Sheet2!$C$4:$C$16
ID=Sheet2!$A$4:$A$16

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>
 
Upvote 0
Maybe this:

Array formula - use Ctrl+Shift+Enter and not only Enter to enter the formula

Code:
=SUM(IF(FREQUENCY(IF(CATEGORY=$E4,IF(ID<>"",MATCH("~"&ID,ID&"",0))),ROW(ID)-ROW(INDEX(ID,1,1))+1),1))

Markmzz
 
Upvote 0
amazing,

what does MATCH("~"&ID,ID&"",0) & ROW(ID)-ROW(INDEX(ID,1,1))+1),1)) do?
 
Upvote 0
PERFECT!!!!!! Right now it works like a charm. THANK YOU SO MUCH!! THE BOTH OF YOU!!!!


If anyone is reading this markmzz and shyy are the biggest help in the world!!!
 
Upvote 0
amazing,

what does MATCH("~"&ID,ID&"",0) & ROW(ID)-ROW(INDEX(ID,1,1))+1),1)) do?

Hi Shyy,

Code:
=MATCH("~"&ID,ID&"",0)

This part of the formula matches the ID range to ID range.
The "~" and "" are used to deal with special characters (like *)


ROW(ID)-ROW(INDEX(ID,1,1))+1

This part of the formula is a vector (from 1 to the last row in the range ID - like {1;2;3;4}).

In the formula, we have something like this:

=SUM(IF(FREQUENCY({1;1;1;4;4;4;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE;FALSE},{1;2;3;4;5;6;7;8;9;10;11;12;13;14}),1))

I hope that this help.

Markmzz
 
Last edited:
Upvote 0
PERFECT!!!!!! Right now it works like a charm. THANK YOU SO MUCH!! THE BOTH OF YOU!!!!


If anyone is reading this markmzz and shyy are the biggest help in the world!!!

You're welcome and thanks for the feedback.

Markmzz
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

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