0

I have to count the spaces within in NumberFormat of each cell in column A. Here is an example NumberFormat:

"                       "@

I translated my VBA code into OfficeScripts ExcelScript (for Excel for Web) but it seems that the replace function doesn't removes the spaces:

sheet.getRange("A1").getNumberFormat().length - sheet.getRange("A1").getNumberFormat().replace(" ", "").length

Is there another option to count the spaces or did I something wrong with the replace function (other letters will be replaced correctly)

1 Answer 1

2

It's just the JavaScript syntax and the solution is:

sheet.getRange("A1").getNumberFormat().length - sheet.getRange("A1").getNumberFormat().replace(\s/g, "").length
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.