Search

B

Brad1982

This is way beyond my skill level so I decided to come here first.

I need to search within a cell and add up all of the numbers. The
problem is the numbers lie within text

A1 contains this:
Green(17)
Red(12)
Blue(16)
Orange(230)

So the search function would add up all the numbers of the cell and
return 275
 
P

Pete

Assuming your values are in A1 to A4, type this formula into B1 and
copy down:

=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1)

Sum these values to get 275.

Hope this helps,

Pete
 
P

Pete

Sorry, you need to convert this to a value. Amended formula:

=VALUE(MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1))

Pete
 
B

Brad1982

Pete said:
Sorry, you need to convert this to a value. Amended formula:

=VALUE(MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1))

Pete

All of the values are in one single cell, not A1 to A4. That is what is
stumping me actually :).
 
P

Pete

Sorry (again), I misunderstood. I'll have a think while I have
something to eat.

Do you have similar entries in A2 and down, or is the problem just a
one-off?

Pete
 
B

Brad1982

I havent gotten any real working formulas myself in the hour or so I put
into it.

I have several cells like this I would like to calc for.

The reasoning behind this is a schedule vs capacity sort of thing.

Rather then add up the individual values in a cell I would just like to
have something calc them for me. It also takes out the human error
problem.

Thanks for your help Pete! I hope you can figure something out :)
 
S

SteveG

This will work for this one cell but it's a lot of maintenance if yo
have the need to sum the same type of data in A2, A3 and A4.

=SUM(VALUE(MID(A1,FIND("(",A1,1)+1,2))+VALUE(MID(A1,FIND("R",A1,1)+FIND("(",A1,1)-2,FIND(")",A1,1)-7))+VALUE(MID(A1,FIND("B",A1,1)+5,FIND(")",A1,1)-7))+VALUE(MID(A1,FIND("O",A1,1)+7,FIND("(",A1,1)-3)))

You can't just copy this down. If you have data in A2, A3 and so o
that you wish to perform this function on, the data has to be identica
meaning in A2 it needs to be in the same order (Green,Red,Blue,Orange
and have the same type of numeric value i.e. Orange always needs to b
in the hundreds, the others always have to be 2 digits. If your dat
is not identical say in A2the first line = Green(116). You hav
increased the number of characters by 1 so all of the formulas abov
need to be adjusted so it would look like.

=SUM(VALUE(MID(A3,FIND("(",A3,1)+1,3))+VALUE(MID(A3,FIND("R",A3,1)+FIND("(",A3,1)-2,FIND(")",A3,1)-8))+VALUE(MID(A3,FIND("B",A3,1)+5,FIND(")",A3,1)-8))+VALUE(MID(A3,FIND("O",A3,1)+7,FIND("(",A3,1)-4)))

Notice the last number that you are adding to the FIND function in eac
is increased by 1.

If Blue changes to 3 characters, you only have to change from the 3r
formula on.

In any event, like I said, it's a lot of maintenance.

HTH

Stev
 
B

Brad1982

SteveG said:
This will work for this one cell but it's a lot of maintenance if you
have the need to sum the same type of data in A2, A3 and A4.

=SUM(VALUE(MID(A1,FIND("(",A1,1)+1,2))+VALUE(MID(A1,FIND("R",A1,1)+FIND("(",A1,1)-2,FIND(")",A1,1)-7))+VALUE(MID(A1,FIND("B",A1,1)+5,FIND(")",A1,1)-7))+VALUE(MID(A1,FIND("O",A1,1)+7,FIND("(",A1,1)-3)))

You can't just copy this down. If you have data in A2, A3 and so on
that you wish to perform this function on, the data has to be identical
meaning in A2 it needs to be in the same order (Green,Red,Blue,Orange)
and have the same type of numeric value i.e. Orange always needs to be
in the hundreds, the others always have to be 2 digits. If your data
is not identical say in A2the first line = Green(116). You have
increased the number of characters by 1 so all of the formulas above
need to be adjusted so it would look like.

=SUM(VALUE(MID(A3,FIND("(",A3,1)+1,3))+VALUE(MID(A3,FIND("R",A3,1)+FIND("(",A3,1)-2,FIND(")",A3,1)-8))+VALUE(MID(A3,FIND("B",A3,1)+5,FIND(")",A3,1)-8))+VALUE(MID(A3,FIND("O",A3,1)+7,FIND("(",A3,1)-4)))

Notice the last number that you are adding to the FIND function in each
is increased by 1.

If Blue changes to 3 characters, you only have to change from the 3rd
formula on.

In any event, like I said, it's a lot of maintenance.

HTH

Steve
The values of the colors are almost never the same and the colors are
always different. Some days it might even be BlueGray or
LightOrange(283982). I will try messing around with that formula and
see if I can come up with anything. Thanks!
 
S

SteveG

How about converting it to columns first, then applying formulas to
those. That way, the formula is always looking at one value rather
than 4 or 5 which makes this cumbersome. You can always do this and
hide those columns when you are done.

Steve
 
B

Brad1982

That is a possibility but would require a complete revamp of
production schedule. The schedule currently has about 200 SKU's on i
on a daily basis. To keep the size of the schedule down in pag
length(currently 4) we use a 7 font and put all of the SKU's for th
appropriate machine in one cell.

Because some days a certain line might have 1 or even 20 SKU's in it
box having columns for each individual SKU may not be possible. Havin
it all in one cell means you would just adjust the cell height an
width for a quick fix to more or less SKU's.

I had just assumed this would be an easy formula for the excel master
here but it looks like it may be very difficult
 
G

Guest

ASAP Utilities, a free Add-in available at www.asap-utilities.com has
features that will strip all the TEXT characters and parenthesis out of the
cell, leaving just the numbers separated by the CHAR(10)
character...........I tried then using the TEXT functions to sum the numbers
but it gets unwieldly quickly, and if you have as many as 20 in a cell, it
would be even more difficult, perhaps exceeding the legal number of
characters in a formula. But maybe this avenue might give someone else an
idea how to sum the numbers...........of course splitting them out with Data
TextToColumns would make it easier, but the OP has reasons not to want to
do it that way..............

Vaya con Dios,
Chuck, CABGx3
 
P

Pete

Rather than do Text to Columns, then, can the data be split onto
separate rows, so that my first interpretation of what you require
would be valid?

If you are saying that there could be a variable number of colours
within these cells, then it will be very difficult to pick them out and
sum them in a single formula, though you could do it with a macro.

Is there always at least a single space after each close-bracket symbol
(except for the end)? We could then look for ") " to determine the
number of entries in each composite cell. Is there any restriction on
the number of columns we can use? If there are 4 entries we could use 4
adjacent cells for each number and another for the sum, so what is the
maximum number of different entries that you could expect in one of
these composite cells?

Could you tell me what SKUs are?

Pete
 
G

Guest

If anyone knows how to do FindAndReplace for the CHAR(10) character, to
replace it with + signs, after stripping it as I described in my previous
post, then just add an equal sign to the front and your got the sum of the
cell regardless of how many there are..............

Vaya con Dios,
Chuck, CABGx3
 
B

Brad1982

It is not just one space after the color each time. It is always enough
spaces to make the word wrap put it to its own line when viewing a
paper document of the spreadsheet. So this would vary based on how long
an the word is. Green would have more spaces after it then Orange would
because it has less letters.

GREEN(240) RED(96)
ORANGE(192)
CLAY(240)

Here is an exact paste of one of my schedule cells. The spacing is
never the same. The only consistant thing is that the number is always
in enclosed like this (number).

"Could you tell me what SKUs are?

Pete"

SKU's = stock keeping unit, in this case they would be the colors
Green, Red, Orange, etc...
 
G

Guest

Ok, first delete all TEXT characters using ASAP Utilities
Then delete the leading and trailing parenthesis using ASAP Utilities
Then do Edit > Replace > and in the "Replace" window hold down the ALT key
and type 010 on the keypad with the NumLock on > and in the "Replace with"
window put a + sign....and do replace all
Then add an = sign to the front of the string and perss enter.....it will
sum the numbers

Vaya con Dios,
Chuck, CABGx3
 
P

Pete

I managed to do this by using a separate sheet, though it's not very
pretty. Assuming the data is in Sheet1, insert a new sheet - I assume
this is Sheet2. To help keep track of what's going on, I used headings
in row1 of Sheet 2, as follows:

B1 = Sum, C1 = Count, D1 = Start, then in E1 to X1 I filled the
sequence 1 to 20, and in Y1 to AR1 I also put the sequence 1 to 20.
Then the following formulae:

B2: =SUM(Y2:AR2)
C2: =COUNT(E2:X2)
D2: 0
E2: =SEARCH(") ",TRIM(Sheet1!$A1)&" ",D2+1)

This is copied across to X2

Y2:
=IF(ISERROR(E2),0,VALUE(MID(TRIM(Sheet1!$A1),SEARCH("(",TRIM(Sheet1!$A1),D2+1)+1,E2-SEARCH("(",TRIM(Sheet1!$A1),D2+1)-1)))

This is copied across to AR2.

The cells B2 to AR2 can then be copied down for as many rows as
necessary.

The following formula is entered in Sheet1 Cell B1 (i.e. next to the
cell we want to analyse):

=Sheet2!B2

and this is copied down as necessary.

I tested it with this in Sheet1 A2:

black(0) brown(1) red(2) orange(3) yellow(4) green(5) blue(6) indigo(7)
violet(8) white(9) purple(10)

and with this in A3:

black(0) brown(1) red(2) orange(3) yellow(4) green(5) blue(6) indigo(7)
violet(8) white(9) purple(10) cyan(11) magenta(12) turquoise(13)
puce(14) ochre(15) pink(16) lightgrey(17) silver(18) gold(19)

It doesn't matter if you have multiple spaces between colours, or at
the end of the string. It will cater for up to 20 colours - you get
#VALUE errors in columns E to X if there are fewer, though this doesn't
matter. The number of colours is counted in column C of Sheet2.

Bit of a sledgehammer to crack a nut, but ...

Hope this helps.

Pete
 
B

Brad1982

Pete said:
I managed to do this by using a separate sheet, though it's not very
pretty. Assuming the data is in Sheet1, insert a new sheet - I assume
this is Sheet2. To help keep track of what's going on, I used headings
in row1 of Sheet 2, as follows:

B1 = Sum, C1 = Count, D1 = Start, then in E1 to X1 I filled the
sequence 1 to 20, and in Y1 to AR1 I also put the sequence 1 to 20.
Then the following formulae:

B2: =SUM(Y2:AR2)
C2: =COUNT(E2:X2)
D2: 0
E2: =SEARCH(") ",TRIM(Sheet1!$A1)&" ",D2+1)

This is copied across to X2

Y2:
=IF(ISERROR(E2),0,VALUE(MID(TRIM(Sheet1!$A1),SEARCH("(",TRIM(Sheet1!$A1),D2+1)+1,E2-SEARCH("(",TRIM(Sheet1!$A1),D2+1)-1)))

This is copied across to AR2.

The cells B2 to AR2 can then be copied down for as many rows as
necessary.

The following formula is entered in Sheet1 Cell B1 (i.e. next to the
cell we want to analyse):

=Sheet2!B2

and this is copied down as necessary.

I tested it with this in Sheet1 A2:

black(0) brown(1) red(2) orange(3) yellow(4) green(5) blue(6)
indigo(7)
violet(8) white(9) purple(10)

and with this in A3:

black(0) brown(1) red(2) orange(3) yellow(4) green(5) blue(6)
indigo(7)
violet(8) white(9) purple(10) cyan(11) magenta(12) turquoise(13)
puce(14) ochre(15) pink(16) lightgrey(17) silver(18) gold(19)

It doesn't matter if you have multiple spaces between colours, or at
the end of the string. It will cater for up to 20 colours - you get
#VALUE errors in columns E to X if there are fewer, though this
doesn't
matter. The number of colours is counted in column C of Sheet2.

Bit of a sledgehammer to crack a nut, but ...

Hope this helps.

Pete

awesome!!!!!! Pete you rock!

CLR I also installed those addins and already can see some uses for
some of the functions. Thanks a ton guys!
 
P

Pete

Thanks for the feedback, glad to be of help.

I think I might install those free add-ins, Chuck.

Pete
 
C

CLR

Yeah, they're pretty neat Pete, I use them a lot.........incidently, in my
description of how to use them for this problem, I've found that one can
eliminate the step of deleting the parenthesis, (duh), and just go ahead
and add the numbers up anyway.....

Vaya con Dios,
Chuck, CABGx3
 
R

Roger Govier

Hi Chuck

Nice solution.
However, for some reason, Edit>Replace would not work for me with ALT
010, or SPACE when trying to insert the + signs.
Any ideas why?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top