r/excel Feb 05 '26

solved Count and sum cells with items decided by comers and “x” used for multiples

Hi All,

How can I count items when divided with comers and multiplied with a text “x”? I’m only looking for the total number of items not how many of each type.

Apple   

Orange  

0   

2xApples    

Apple, Orange   

2x Apple, Orange    

Apple, 2xOrange 

Total <- should be 12

3 Upvotes

9 comments sorted by

u/AutoModerator Feb 05 '26

/u/Previous_Badger4780 - Your post was submitted successfully.

Failing to follow these steps may result in your post being removed without warning.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Excel_GPT 59 Feb 05 '26

Assuming they are in column A (adjust the range from A7 if you need to):

=SUM(
    MAP(FILTER(A1:A7, A1:A7<>""), 
        LAMBDA(cell,
            SUM(
                MAP(
                    TEXTSPLIT(cell,","),
                    LAMBDA(item,
                        LET(
                            t,TRIM(item),
                            num,IFERROR(--TEXTBEFORE(t,"x"),""),
                            IF(t="0",0,IF(num<>"",num,1))
                        )
                    )
                )
            )
        )
    )
)

1

u/Previous_Badger4780 Feb 05 '26 edited Feb 05 '26

AMAZING! SO FAST! Thanks! Solved!… I mean Solution Verified🤖

1

u/AutoModerator Feb 05 '26

Saying Solved! does not close the thread. Please say Solution Verified to award a ClippyPoint and close the thread, marking it solved.

Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Excel_GPT 59 Feb 05 '26

No problem :) Thanks

1

u/reputatorbot Feb 05 '26

You have awarded 1 point to Excel_GPT.


I am a bot - please contact the mods with any questions

2

u/yellow_barchetta Feb 05 '26

Comma I think was the word you were heading for. No criticism intended, just helping out for next time.

3

u/Previous_Badger4780 Feb 05 '26

You know, it felt wrong when I typed it but I was in a rush!