LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,231
Default add multiple numbers in one cell with those numbers remainingvisi

"Rick Rothstein" wrote...
Assuming Harlan's guess is correct (your cells could contain a string like 1
2 4 17 -5 2 0 -7 23 which you want to total up to get 37 as the answer)...
if you are able to use VB code . . .

....

If security isn't an issue, and the OP is (and/or his/her users are)
running Excel 2002 or later versions, then the OP could just use a
defined name calling an XLM function.

If the string of numeric substrings were in cell C5 and the sum of
those substrings were supposed to be in cell D5, with cell D5 the
active cell, define the name SUMNSS as the formula

=EVAL(SUBSTITUTE(TRIM(C5)," ","+"))

then enter the formula =SUMNSS in cell D5. This particular approach
won't trigger macro security warnings when opening the workbook.

If you're going to use VBA udfs, better to make the udfs general
rather than overly particular. In this case, a simple VBA wrapper
around the Excel OM's Evaluate would be the better approach.

Function evaludf(s As String): evaludf = Evaluate(s): End Function

Then try the formula

=evaludf(SUBSTITUTE(TRIM(C5)," ","+"))


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting specific numbers from a cell containing multiple numbers JRD Excel Worksheet Functions 3 January 18th 09 12:32 AM
Help! How do you get excel to find the x(changes daily, marked in a cell from another formula) highest numbers in a group of numbers and sum them up? C-Man23 Excel Worksheet Functions 3 January 19th 06 09:52 AM
can a single cell contain multiple numbers? jw446 Excel Worksheet Functions 5 August 10th 05 06:16 PM
Can you add multiple numbers in the same cell%3f pam Excel Worksheet Functions 2 January 28th 05 04:13 PM
Counting multiple numbers in one cell clubin Excel Worksheet Functions 6 December 8th 04 02:47 PM


All times are GMT +1. The time now is 04:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"