Need help! extract value in special case, find many method, cannot solve it!

CLKinfo

New Member
Joined
Oct 19, 2024
Messages
4
Office Version
  1. 2021
Platform
  1. Windows
Dear All Expert,

my problem question is how to extract total sum value as belows number pattern at the cell.

the number pattern is: e.g.

A1 cell

987789 x 9, 789789 x 4, 000987, 987765, 888999 x 3 now i'd manually to add the total sum to get the total result is "18" at B1 cell

the result is came from like that "9", "4", "1", "1", "3", so total sum is "18"

because as above data input method to show how many set of item no.,

987789 have 9 sets
789789 have 4 sets
000987 only 1 set (so no mulitple "x") so count 1
987765 only 1 set (so no mulitple "x") so count 1
888999 have 3 sets

Sometimes maybe 3 items data, 098767, 898767 x 3, 567889 x 2 so total is "6"

Up to now, limited in my ability, i can't find a way to solve it!

Thanks,
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Your data pattern is not very excel friendly, best thing I can come up with is this but it might not work with everything

Excel Formula:
=SUM(IFERROR(--INDEX(TEXTSPLIT(A1," x ",",",,1),,2),1))
 
Upvote 0
A2=987789 x 9, 789789 x 4, 000987, 987765, 888999 x 3
Formula(UDF) in B2
=GetMultiplierSum(A2)

Try this UDF solution.
Code:
VBA Code:
Function GetMultiplierSum(Ip As String)
Dim M, T&, K&, temp#
M = Split(Ip, ",")
For T = 0 To UBound(M)
K = InStr(1, M(T), "x")
If K > 0 Then
temp = temp + Val(Trim(Mid(M(T), K + 1)))
Else
temp = temp + 1
End If
Next T
GetMultiplierSum = temp
End Function
How to Use UDF code:
In the developer tab click--> Visual Basic
VB window opens
Insert--> Module
Paste the code.
Close the VB window.
Now UDF is available in Function List
This function can be used like other functions in excel.
Save file as .xlsm
 
Upvote 0
Your data pattern is not very excel friendly, best thing I can come up with is this but it might not work with everything

Excel Formula:
=SUM(IFERROR(--INDEX(TEXTSPLIT(A1," x ",",",,1),,2),1))
Hi Jasonb75,

Anyway, thank you so much, i will try it.

Best Regards,
C
 
Upvote 0
A2=987789 x 9, 789789 x 4, 000987, 987765, 888999 x 3
Formula(UDF) in B2
=GetMultiplierSum(A2)

Try this UDF solution.
Code:
VBA Code:
Function GetMultiplierSum(Ip As String)
Dim M, T&, K&, temp#
M = Split(Ip, ",")
For T = 0 To UBound(M)
K = InStr(1, M(T), "x")
If K > 0 Then
temp = temp + Val(Trim(Mid(M(T), K + 1)))
Else
temp = temp + 1
End If
Next T
GetMultiplierSum = temp
End Function
How to Use UDF code:
In the developer tab click--> Visual Basic
VB window opens
Insert--> Module
Paste the code.
Close the VB window.
Now UDF is available in Function List
This function can be used like other functions in excel.
Save file as .xlsm
Hi kvsrinivasamurthy,

Thank you so much your advise, hope i can do this.

Thanks,
C
 
Upvote 0
Dear All Expert,

my problem question is how to extract total sum value as belows number pattern at the cell.

the number pattern is: e.g.

A1 cell

987789 x 9, 789789 x 4, 000987, 987765, 888999 x 3 now i'd manually to add the total sum to get the total result is "18" at B1 cell

the result is came from like that "9", "4", "1", "1", "3", so total sum is "18"

because as above data input method to show how many set of item no.,

987789 have 9 sets
789789 have 4 sets
000987 only 1 set (so no mulitple "x") so count 1
987765 only 1 set (so no mulitple "x") so count 1
888999 have 3 sets

Sometimes maybe 3 items data, 098767, 898767 x 3, 567889 x 2 so total is "6"

Up to now, limited in my ability, i can't find a way to solve it!

Thanks,
Try once combination of Text to columns & if condition
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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