• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Convert to amounts

Shabbo

Member
Dear Sir,

I am not able to calculate total of the numbers in attached sheet can you please advise the best solution.

When I select one more cell its giving only count but I want sum as well.
 

Attachments

  • Purchase Register.xlsx
    78.7 KB · Views: 10
Yes ... it's text
why to get 'number'-data as texts
if You want to use it as numbers?
You asked to "advise the best solution."
 
A quick examination of your workbook shows that many of the cells contain the character ascii code 160 (a non-breaking space, did you paste this data from the web? If you look at the source of the web page it would likely appear as &nbsp) So I suggest one of two things:
1. Run a one line macro which will work on the entire active sheet:
Code:
Sub blah()
Cells.Replace What:=Chr(160), Replacement:="", LookAt:=xlPart, SearchFormat:=False, ReplaceFormat:=False
End Sub
or
2. follow the following instructions to the letter:
  • Select any cell with what looks like a number but you've found isn't a number. I've used H12 here:
upload_2017-6-12_15-55-11.png

and I've selected the whole value in the formula bar to show there are leading characters.
  • Select only one of those leading characters:
upload_2017-6-12_15-57-42.png
  • (they're quite narrow, use the arrow keys on the keyboard in conjunction with the shift key to be sure you only select one of them)
  • then on the keyboard put that single character into the clipboard with Ctrl+c on the keyboard.
  • Press the escape key.
  • Make sure you only have one (any) cell selected on the sheet (this means the whole sheet will be processed) or select a single range of cells that you want to limit the processing to.
  • Press Ctrl+h (this'll bring up the search and replace dialogue box).
  • In the Find what: field make sure it's empty first, then press Ctrl+v to paste that single character in there (you'll see nothing obvious in that field).
  • Then make sure the Replace with: field is empty.
  • The rest of the dialogue box should look like this:
upload_2017-6-12_16-4-55.png
  • Click on Replace All.
  • Dismiss the report message
  • Click Close.
That's it, you've finished.

The attached contains the macro. Click the button on the sheet to run it.
 

Attachments

  • Chandoo34708Purchase Register.xlsm
    87.6 KB · Views: 0
Back
Top