boodschappenlijstje uitgaven optellen

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
503
Office Version
  1. 365
Platform
  1. Windows
dag allemaal :)
ik probeer uit een string (boodschappenlijstje) met een formule de bedragen te halen en op te tellen...
met een matrix lukt niet omdat het samengevoegde cellen zijn...
hoe kan ik uit (bv.) cel AG5 " water 0,75 melk 1,25 chocolade 3,50 brood 1,45 "
het totaal in cel AG8 zetten? (=> 6,95)
vanzelfsprekend kan het aantal items verschillen, wel altijd spaties tussen item en bedrag...
mooie dag nog !!!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Using "." as decimal separator, here is one idea:
MrExcel_20240311.xlsx
AB
1Shopping list: milk 5.50 milk chocolate 2.56 dark chocolate 4.45 bread 3.3215.83
Sheet6
Cell Formulas
RangeFormula
B1B1=LET(astr,MID(A1,SEQUENCE(LEN(A1)),1),bstr,IF(astr=".",".",IF(astr=" ",",",IFERROR(astr*1,""))),cstr,TEXTJOIN("",1,bstr),SUM(TEXTSPLIT(cstr,,",",1)*1))

I think you are using "," decimal separator, so some edits will be necessary.

This version may work with comma ( , ) decimal separator, although I cannot test it with my current setup.
Excel Formula:
=LET(astr,MID(A3,SEQUENCE(LEN(A3)),1),bstr,IF(astr=",",",",IF(astr=" ",";",IFERROR(astr*1,""))),cstr,TEXTJOIN("",1,bstr),SUM(TEXTSPLIT(cstr,,";",1)*1))
 
Last edited:
Upvote 0
thank you so much for your answer !
it looks like japanese to me, not chinese i can speak and write that...
can you give me the dutch excel translations of astr and bstr ? i find nowhere what it could be...
hoping it'll work !!!
peter, leuven
 
Upvote 0
I will try.

There are four sets of calculations. The first three are assigned variable names: astr, bstr, and cstr. The names are arbitrary. Each of the first three steps creates or changes a text string, so I used "a", "b", and "c" followed by an abbreviation for text string. You may change these names to your preference, but do not use numbers. Change the names everywhere they appear because three of the steps use the result from an earlier step.

Er zijn vier sets berekeningen. Aan de eerste drie worden variabelenamen toegewezen: astr, bstr en cstr. De namen zijn willekeurig. Bij elk van de eerste drie stappen wordt een tekstreeks gemaakt of gewijzigd, dus heb ik "a", "b" en "c" gebruikt, gevolgd door een afkorting voor tekstreeks. U kunt deze namen naar eigen voorkeur wijzigen, maar gebruik geen cijfers. Verander de namen overal waar ze verschijnen, omdat drie van de stappen het resultaat van een eerdere stap gebruiken.

The formula uses 9 functions. I am not certain about some of the translations:
De formule gebruikt 9 functies. Van sommige vertalingen ben ik niet zeker:

MrExcel_20240311.xlsx
BC
8The formula uses 9 functions:
9EnglishDutch
10LETLET
11MIDDEEL
12SEQUENCEREEKS
13LENLENGTE
14IFALS
15IFERRORALS.FOUT
16TEXTJOINTEKST.COMBINEREN
17TEXTSPLITTEKST.SPLITSEN
18SUMSOM
Sheet6


Excel Formula:
=LET(
    astr, MID(A1, SEQUENCE(LEN(A1)), 1),
    bstr, IF(astr = ".", ".", IF(astr = " ", "|", IFERROR(astr * 1, ""))),
    cstr, TEXTJOIN("", 1, bstr),
    SUM(TEXTSPLIT(cstr, , "|", 1) * 1)
)

Excel Formula:
=LET(astr;DEEL(A1;SEQUENCE(LENGTE(A1));1);bstr;ALS(astr=".";".";ALS(astr=" ";"|";ALS.FOUT(astr*1;"")));cstr;TEKST.COMBINEREN("";1;bstr);SOM(TEXTSPLIT(cstr;;"|";1)*1))

I am mostly concerned about the differences between list separators in my version of Excel and yours. I use a comma, and I think you use a semicolon? And for decimal numbers, I use a period decimal separator, and I think you use a comma?

Ik maak me vooral zorgen over de verschillen tussen lijstscheidingstekens in mijn versie van Excel en die van jou. Ik gebruik een komma, en ik denk dat jij een puntkomma gebruikt? En voor decimale getallen gebruik ik een decimaal scheidingsteken, en ik denk dat jij een komma gebruikt?

I changed the formula slightly to use a different row separator (|). The four parts of the formula are demonstrated here in columns D, E, F, and G, to help with changing the formula to work with your decimal convention. You may need to change "," to ";" and "." to ",".

Ik heb de formule enigszins gewijzigd om een ander rijscheidingsteken (|) te gebruiken. De vier delen van de formule worden hier gedemonstreerd in de kolommen D, E, F en G, om u te helpen bij het wijzigen van de formule zodat deze met uw decimale conventie werkt. Mogelijk moet u "," in ";" veranderen En "." naar ",".

MrExcel_20240311.xlsx
AB
1List: milk 5.50, dark chocolate 4.45 bread 3.3213.27
Sheet6
Cell Formulas
RangeFormula
B1B1=LET(astr,MID(A1,SEQUENCE(LEN(A1)),1),bstr,IF(astr=".",".",IF(astr=" ","|",IFERROR(astr*1,""))),cstr,TEXTJOIN("",1,bstr),SUM(TEXTSPLIT(cstr,,"|",1)*1))


MrExcel_20240311.xlsx
DEFG
1astrbstrcstrfinal result
2L ||5.50|||4.45|||3.3213.27
3i
4s
5t
6:
7 |
8m
9i
10l
11k
12 |
1355
14..
1555
1600
17,
18 |
19d
20a
21r
22k
23 |
24c
25h
26o
27c
28o
29l
30a
31t
32e
33 |
3444
35..
3644
3755
38 |
39 |
40b
41r
42e
43a
44d
45 |
4633
47..
4833
4922
Sheet6
Cell Formulas
RangeFormula
D2:D49D2=MID(A1,SEQUENCE(LEN(A1)),1)
E2:E49E2=IF(D2#=".",".",IF(D2#=" ","|",IFERROR(D2#*1,"")))
F2F2=TEXTJOIN("",1,E2#)
G2G2=SUM(TEXTSPLIT(F2,,"|",1)*1)
Dynamic array formulas.
 
Upvote 0
I will try.

There are four sets of calculations. The first three are assigned variable names: astr, bstr, and cstr. The names are arbitrary. Each of the first three steps creates or changes a text string, so I used "a", "b", and "c" followed by an abbreviation for text string. You may change these names to your preference, but do not use numbers. Change the names everywhere they appear because three of the steps use the result from an earlier step.

Er zijn vier sets berekeningen. Aan de eerste drie worden variabelenamen toegewezen: astr, bstr en cstr. De namen zijn willekeurig. Bij elk van de eerste drie stappen wordt een tekstreeks gemaakt of gewijzigd, dus heb ik "a", "b" en "c" gebruikt, gevolgd door een afkorting voor tekstreeks. U kunt deze namen naar eigen voorkeur wijzigen, maar gebruik geen cijfers. Verander de namen overal waar ze verschijnen, omdat drie van de stappen het resultaat van een eerdere stap gebruiken.

The formula uses 9 functions. I am not certain about some of the translations:
De formule gebruikt 9 functies. Van sommige vertalingen ben ik niet zeker:
I will try.

There are four sets of calculations. The first three are assigned variable names: astr, bstr, and cstr. The names are arbitrary. Each of the first three steps creates or changes a text string, so I used "a", "b", and "c" followed by an abbreviation for text string. You may change these names to your preference, but do not use numbers. Change the names everywhere they appear because three of the steps use the result from an earlier step.

Er zijn vier sets berekeningen. Aan de eerste drie worden variabelenamen toegewezen: astr, bstr en cstr. De namen zijn willekeurig. Bij elk van de eerste drie stappen wordt een tekstreeks gemaakt of gewijzigd, dus heb ik "a", "b" en "c" gebruikt, gevolgd door een afkorting voor tekstreeks. U kunt deze namen naar eigen voorkeur wijzigen, maar gebruik geen cijfers. Verander de namen overal waar ze verschijnen, omdat drie van de stappen het resultaat van een eerdere stap gebruiken.

The formula uses 9 functions. I am not certain about some of the translations:
De formule gebruikt 9 functies. Van sommige vertalingen ben ik niet zeker:

MrExcel_20240311.xlsx
BC
8The formula uses 9 functions:
9EnglishDutch
10LETLET
11MIDDEEL
12SEQUENCEREEKS
13LENLENGTE
14IFALS
15IFERRORALS.FOUT
16TEXTJOINTEKST.COMBINEREN
17TEXTSPLITTEKST.SPLITSEN
18SUMSOM
Sheet6


Excel Formula:
=LET(
    astr, MID(A1, SEQUENCE(LEN(A1)), 1),
    bstr, IF(astr = ".", ".", IF(astr = " ", "|", IFERROR(astr * 1, ""))),
    cstr, TEXTJOIN("", 1, bstr),
    SUM(TEXTSPLIT(cstr, , "|", 1) * 1)
)

Excel Formula:
=LET(astr;DEEL(A1;SEQUENCE(LENGTE(A1));1);bstr;ALS(astr=".";".";ALS(astr=" ";"|";ALS.FOUT(astr*1;"")));cstr;TEKST.COMBINEREN("";1;bstr);SOM(TEXTSPLIT(cstr;;"|";1)*1))

I am mostly concerned about the differences between list separators in my version of Excel and yours. I use a comma, and I think you use a semicolon? And for decimal numbers, I use a period decimal separator, and I think you use a comma?

Ik maak me vooral zorgen over de verschillen tussen lijstscheidingstekens in mijn versie van Excel en die van jou. Ik gebruik een komma, en ik denk dat jij een puntkomma gebruikt? En voor decimale getallen gebruik ik een decimaal scheidingsteken, en ik denk dat jij een komma gebruikt?

I changed the formula slightly to use a different row separator (|). The four parts of the formula are demonstrated here in columns D, E, F, and G, to help with changing the formula to work with your decimal convention. You may need to change "," to ";" and "." to ",".

Ik heb de formule enigszins gewijzigd om een ander rijscheidingsteken (|) te gebruiken. De vier delen van de formule worden hier gedemonstreerd in de kolommen D, E, F en G, om u te helpen bij het wijzigen van de formule zodat deze met uw decimale conventie werkt. Mogelijk moet u "," in ";" veranderen En "." naar ",".

MrExcel_20240311.xlsx
AB
1List: milk 5.50, dark chocolate 4.45 bread 3.3213.27
Sheet6
Cell Formulas
RangeFormula
B1B1=LET(astr,MID(A1,SEQUENCE(LEN(A1)),1),bstr,IF(astr=".",".",IF(astr=" ","|",IFERROR(astr*1,""))),cstr,TEXTJOIN("",1,bstr),SUM(TEXTSPLIT(cstr,,"|",1)*1))


MrExcel_20240311.xlsx
DEFG
1astrbstrcstrfinal result
2L ||5.50|||4.45|||3.3213.27
3i
4s
5t
6:
7 |
8m
9i
10l
11k
12 |
1355
14..
1555
1600
17,
18 |
19d
20a
21r
22k
23 |
24c
25h
26o
27c
28o
29l
30a
31t
32e
33 |
3444
35..
3644
3755
38 |
39 |
40b
41r
42e
43a
44d
45 |
4633
47..
4833
4922
Sheet6
Cell Formulas
RangeFormula
D2:D49D2=MID(A1,SEQUENCE(LEN(A1)),1)
E2:E49E2=IF(D2#=".",".",IF(D2#=" ","|",IFERROR(D2#*1,"")))
F2F2=TEXTJOIN("",1,E2#)
G2G2=SUM(TEXTSPLIT(F2,,"|",1)*1)
Dynamic array formulas.

hello !
thank you for all the efforts :)
what should i do with the assigned variables??? my excel doesnt recognise them... i think that's logic? astr bstr cstr... it's not vba i cannot define them in a formula?
my english is quiet good, and i know how to translate excel english to dutch, the only problem is recognising real functions and variables... thank you !!!
 
Upvote 0
The LET function assigns the formula following astr to the variable astr…and so on for bstr, and cstr. The variable names are arbitrary. You can change them, but do not use a number in the name. If you do change them, change the name where it is first assigned, and then change it everywhere else that name is referred to. Excel will not recognize the name unless it is inside the LET function.

Fir example, in my previous post, astr is
MID(A1, SEQUENCE(LEN(A1)), 1)
So astr is a single column array.
 
Upvote 0
I will try.

There are four sets of calculations. The first three are assigned variable names: astr, bstr, and cstr. The names are arbitrary. Each of the first three steps creates or changes a text string, so I used "a", "b", and "c" followed by an abbreviation for text string. You may change these names to your preference, but do not use numbers. Change the names everywhere they appear because three of the steps use the result from an earlier step.

Er zijn vier sets berekeningen. Aan de eerste drie worden variabelenamen toegewezen: astr, bstr en cstr. De namen zijn willekeurig. Bij elk van de eerste drie stappen wordt een tekstreeks gemaakt of gewijzigd, dus heb ik "a", "b" en "c" gebruikt, gevolgd door een afkorting voor tekstreeks. U kunt deze namen naar eigen voorkeur wijzigen, maar gebruik geen cijfers. Verander de namen overal waar ze verschijnen, omdat drie van de stappen het resultaat van een eerdere stap gebruiken.

The formula uses 9 functions. I am not certain about some of the translations:
De formule gebruikt 9 functies. Van sommige vertalingen ben ik niet zeker:

MrExcel_20240311.xlsx
BC
8The formula uses 9 functions:
9EnglishDutch
10LETLET
11MIDDEEL
12SEQUENCEREEKS
13LENLENGTE
14IFALS
15IFERRORALS.FOUT
16TEXTJOINTEKST.COMBINEREN
17TEXTSPLITTEKST.SPLITSEN
18SUMSOM
Sheet6


Excel Formula:
=LET(
    astr, MID(A1, SEQUENCE(LEN(A1)), 1),
    bstr, IF(astr = ".", ".", IF(astr = " ", "|", IFERROR(astr * 1, ""))),
    cstr, TEXTJOIN("", 1, bstr),
    SUM(TEXTSPLIT(cstr, , "|", 1) * 1)
)

Excel Formula:
=LET(astr;DEEL(A1;SEQUENCE(LENGTE(A1));1);bstr;ALS(astr=".";".";ALS(astr=" ";"|";ALS.FOUT(astr*1;"")));cstr;TEKST.COMBINEREN("";1;bstr);SOM(TEXTSPLIT(cstr;;"|";1)*1))

I am mostly concerned about the differences between list separators in my version of Excel and yours. I use a comma, and I think you use a semicolon? And for decimal numbers, I use a period decimal separator, and I think you use a comma?

Ik maak me vooral zorgen over de verschillen tussen lijstscheidingstekens in mijn versie van Excel en die van jou. Ik gebruik een komma, en ik denk dat jij een puntkomma gebruikt? En voor decimale getallen gebruik ik een decimaal scheidingsteken, en ik denk dat jij een komma gebruikt?

I changed the formula slightly to use a different row separator (|). The four parts of the formula are demonstrated here in columns D, E, F, and G, to help with changing the formula to work with your decimal convention. You may need to change "," to ";" and "." to ",".

Ik heb de formule enigszins gewijzigd om een ander rijscheidingsteken (|) te gebruiken. De vier delen van de formule worden hier gedemonstreerd in de kolommen D, E, F en G, om u te helpen bij het wijzigen van de formule zodat deze met uw decimale conventie werkt. Mogelijk moet u "," in ";" veranderen En "." naar ",".

MrExcel_20240311.xlsx
AB
1List: milk 5.50, dark chocolate 4.45 bread 3.3213.27
Sheet6
Cell Formulas
RangeFormula
B1B1=LET(astr,MID(A1,SEQUENCE(LEN(A1)),1),bstr,IF(astr=".",".",IF(astr=" ","|",IFERROR(astr*1,""))),cstr,TEXTJOIN("",1,bstr),SUM(TEXTSPLIT(cstr,,"|",1)*1))


MrExcel_20240311.xlsx
DEFG
1astrbstrcstrfinal result
2L ||5.50|||4.45|||3.3213.27
3i
4s
5t
6:
7 |
8m
9i
10l
11k
12 |
1355
14..
1555
1600
17,
18 |
19d
20a
21r
22k
23 |
24c
25h
26o
27c
28o
29l
30a
31t
32e
33 |
3444
35..
3644
3755
38 |
39 |
40b
41r
42e
43a
44d
45 |
4633
47..
4833
4922
Sheet6
Cell Formulas
RangeFormula
D2:D49D2=MID(A1,SEQUENCE(LEN(A1)),1)
E2:E49E2=IF(D2#=".",".",IF(D2#=" ","|",IFERROR(D2#*1,"")))
F2F2=TEXTJOIN("",1,E2#)
G2G2=SUM(TEXTSPLIT(F2,,"|",1)*1)
Dynamic array formulas.

Hello :)

yeahhhh i have the formula working :
Excel Formula:
=LET(astr;DEEL(AG5;REEKS(LENGTE(AG5));1);bstr;ALS(astr=".";".";ALS(astr=" ";"|";ALS.FOUT(astr*1;"")));cstr;TEKST.COMBINEREN("";1;bstr);SOM(TEKST.SPLITSEN(cstr;;"|";1)*1))

but: it works perfectly only without numbers after the . or , so 15 7 35 ok, but 15,25 or 15.25 give a wrong total...
thank you so much for helping !!! almost there !
 
Upvote 0
I will look when I get back to my computer. That seems to be an issue with the decimal separator in the formula. You normally use a comma, correct?… as in 15,50 for the value halfway between 15 and 16?
 
Upvote 0
I will look when I get back to my computer. That seems to be an issue with the decimal separator in the formula. You normally use a comma, correct?… as in 15,50 for the value halfway between 15 and 16?
i do normally use a . maybe that also is less confusing but i'm willing to use either if that's better for the solution :) thanks and good luck !!!!
 
Upvote 0
i do normally use a . maybe that also is less confusing but i'm willing to use either if that's better for the solution :) thanks and good luck !!!!
hey,
i discovered what he does wrong : he removes the , from 3,25 thus becoming 325 and adding up is correct: 3,25 + 2,75 => 325 + 275 = 600. good luck with the solution !!!
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
Latest member
Anshu121

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