+ Reply to Thread
Results 1 to 8 of 8

Write a cell function that will take the number 16 and turn it into 1+6=7

  1. #1
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Write a cell function that will take the number 16 and turn it into 1+6=7

    I am trying to figure out a way to write a function in Excel for the following scenario:

    I have a row of nine single digit numbers from 0 to 9. Each number is in its own cell. Each number is multipled by either 1 or 2, so the largest two digit number would be 18.

    That said, you might have a 6 in one cell and 16 in another. If you have a 6 in the cell, then its sum will show as 6. However, if you have 16 in the cell, the sum needs to be 1 + 6 = 7.

    How would I write a formula for the cell containing 16 that I can just drag across for my spreadsheet?

    Thanks!

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    Try..

    =A1-FLOOR(A1-1,9)

    Compliments of DLL..
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    Pefect - thank you!

  4. #4
    Valued Forum Contributor
    Join Date
    11-22-2014
    Location
    Arizona, USA
    MS-Off Ver
    Office 365
    Posts
    973

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    Do you have the 1 or 2 in a separate cell as well?
    Lets say you were setting up a multiplication table... and wanted the results to be as you have listed...
    The following will do this and is nested with 4 If statements. If it is less than 10 it will multiply straight out, Less than 100 will give you the sum of the left and right, if it is less than 1000 it will get the sum of the left, middle and right and then finally less than 10000 will give you the sum of left, left middle, right middle, right. 10000 and up will be blank... though you can continue to add/modify that
    Please Login or Register  to view this content.
    Here is an Example of the above applied. Notice that it is multiplying Row 1 by Column A

    Example.xlsx

    Cheers
    -If you think you are done, Start over - ELeGault

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    another
    =MOD(A1-1,9)+1
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    another
    =MOD(A1-1,9)+1
    edit you may want to cater for 0 or blank
    =IF(A1=0,0,MOD(A1-1,9)+1) or
    =IFERROR(A1-FLOOR(A1-1,9),0)

  7. #7
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    The last two formulas that accomodate the 0 value work great. Thank you

    =IF(A1=0,0,MOD(A1-1,9)+1) or
    =IFERROR(A1-FLOOR(A1-1,9),0)

  8. #8
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Write a cell function that will take the number 16 and turn it into 1+6=7

    thanks for the feedback,glad we could help

+ 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. Is there a way to make a cell turn Red if it is over a certain number
    By bebe2629 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-08-2014, 04:11 PM
  2. [SOLVED] Condition and function to write number value greater than a specific number
    By excelinexcel7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2012, 06:09 PM
  3. If cell has x turn into number and concatenate
    By zbor in forum Excel General
    Replies: 5
    Last Post: 07-04-2009, 07:28 AM
  4. Replies: 2
    Last Post: 06-29-2009, 05:17 AM
  5. [SOLVED] how to write function to find max deviation from specific number .
    By barbdee in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-15-2005, 11:15 PM

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