+ Reply to Thread
Results 1 to 14 of 14

Multiply cell by amount of names in another cell with exclusions

  1. #1
    Registered User
    Join Date
    05-02-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Multiply cell by amount of names in another cell with exclusions

    Hi All

    Hoping for some help here please.

    I am extracting data from our scheduling tool and need to be able to multiply a value by the amount of people assigned to that task with certain exclusions.

    The people assigned to the task are all listed in the same cell, separated by comma's and in between [ ].

    Using row 2 from the attached worksheet as an example, the assignees in column D are [James Brown, James Dice] and the time estimate in column G is 1.30. As there are 2 names in cell D2, I need to multiply cell G2 by 2 in either G2 or in J2 (empty cell).


    However there are 3 assignees "R", "S" and "T" that will appear in column D which I need to exclude from this. For example cell D3 is [Liam Heath, T] and should therefore only multiply by 1. Another example in cell D5 - [James Bond, James Dice, James Brown, R] - This should only multiply by 3.


    Some cells in column D will only have [] which can be left alone / multiply by 0 / multiply by 1. Whichever is easiest to achieve given the above request.


    In the example I have used made up names. R, S, and T are actual however and have not been changed.


    Thank you
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Multiply cell by amount of names in another cell with exclusions

    Will R, S and T appear this way in the real data, or as names? Desensitised data still need to fully represent the real data.

    Please add manually calculated results that you would expect from this data in a spare column on the right.

    You could try this for starters:

    =G2*(LEN(SUBSTITUTE(D2,IFERROR(LOOKUP(1000,SEARCH({", R",", S",", T"},D2),{", R",", S",", T"}),""),""))-LEN(SUBSTITUTE(SUBSTITUTE(D2,IFERROR(LOOKUP(1000,SEARCH({", R",", S",", T"},D2),{", R",", S",", T"}),""),""),",",""))+1)
    Last edited by AliGW; 06-20-2021 at 03:47 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    05-02-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Multiply cell by amount of names in another cell with exclusions

    Hi AliGW

    Yes R, S and T will appear that way.

    The formula works perfectly except for when R, S and T are at the beginning of the list of names. Apologies this example was not included in the sample. I have reattached the sample with expected values and another example all highlighted in green, with your formula at the end.
    Attached Files Attached Files

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Multiply cell by amount of names in another cell with exclusions

    Try this:

    =G2*(LEN(SUBSTITUTE(D2,IFERROR(LOOKUP(1000,SEARCH({", R",", S",", T","R, ","S, ","T, "},D2),{", R",", S",", T","R, ","S, ","T, "}),""),""))-LEN(SUBSTITUTE(SUBSTITUTE(D2,IFERROR(LOOKUP(1000,SEARCH({", R",", S",", T","R, ","S, ","T, "},D2),{", R",", S",", T","R, ","S, ","T, "}),""),""),",",""))+1)

  5. #5
    Registered User
    Join Date
    05-02-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Multiply cell by amount of names in another cell with exclusions

    That solves the issue however now actual names that end with the letter R, S or T followed by another name or R, S or T - (example [Marcel Cooper, S]) - now multiplies. This can be seen in row 7.
    Attached Files Attached Files

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Multiply cell by amount of names in another cell with exclusions

    OK - I'm done. Sorry. No further suggestions. Someone else may have a better idea.

  7. #7
    Registered User
    Join Date
    05-02-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    6

    Re: Multiply cell by amount of names in another cell with exclusions

    Thank you. For now I will use find and replace to remove entire surnames ending in R, S or T. Your formula works perfectly following this.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Multiply cell by amount of names in another cell with exclusions

    That's a workaround, at least, but not ideal. I've been thinking about it and still haven't found another way. Thanks for the rep, though.

  9. #9
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Multiply cell by amount of names in another cell with exclusions

    Another option, Same function , My formula is also very long, please refer to it

    Cell J2 formula , drag down

    HTML Code: 
    Last edited by wk9128; 06-20-2021 at 08:04 AM.

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,432

    Re: Multiply cell by amount of names in another cell with exclusions

    How does your suggestion get over the issue with mine?

  11. #11
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,459

    Re: Multiply cell by amount of names in another cell with exclusions

    Sucuri firewall are stopping me! I can not post my explanation here!

    See attachment. See my wolds in spreadsheet. I have no idea why sucuri stopped me.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by bebo021999; 06-20-2021 at 10:46 PM.
    Quang PT

  12. #12
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Multiply cell by amount of names in another cell with exclusions

    @ Quang PT

    It's the nested REPLACE functions Sucuri doesn't like. Try selecting the formula and applying a color to it. Even Black works. It's crazy I know, but so is Sucuri.
    Dave

  13. #13
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: Multiply cell by amount of names in another cell with exclusions

    Please try

    =IFERROR(G2*ROWS(FILTERXML("<x><m>"&SUBSTITUTE(SUBSTITUTE(D2," ",),",","</m><m>")&"</m></x>","//m[string-length()>2]")),0)
    Attached Files Attached Files

  14. #14
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Taiwan
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,380

    Re: Multiply cell by amount of names in another cell with exclusions

    The 365 version can be simplified as much as possible. It is really powerful. Learn from Bo_Ry GURU. If I have the opportunity to upgrade and study the 365 version

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Count if above amount and multiply extra by %
    By HelenClark in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-09-2016, 09:34 AM
  2. Replies: 11
    Last Post: 03-27-2014, 07:55 PM
  3. [SOLVED] Need a formula to multiply an amount and the difference over a set value
    By AndrewBondarchuk in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-28-2012, 03:59 PM
  4. [SOLVED] Multiply, Divide and Then Multiply in a cell
    By Brownie2576 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-22-2012, 08:57 PM
  5. Replies: 5
    Last Post: 09-30-2010, 08:02 PM
  6. Replies: 1
    Last Post: 03-03-2010, 05:26 AM
  7. calculate time and multiply it by $ amount
    By DR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2006, 02:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1