In excel, is there a way to insert commas into numbers which themselves are embedded in normal-text?

StackOverflow https://stackoverflow.com/questions/23312522

  •  10-07-2023
  •  | 
  •  

Question

Suppose in Excel If have a column like so:

STGADM.CK_ACCT - 6863349
STGADM.CK_ADJ - 10378906
STGADM.CK_BILL - 81880214
STGADM.CK_BSEG - 80849690
STGADM.CK_FT - 162025408
STGADM.CK_MR - 124169555
STGADM.CK_MTR - 6953099
STGADM.CK_MTR_CONFIG - 6953099
STGADM.CK_PAY - 77355566
STGADM.CK_PAY_EVENT - 77355566
STGADM.CK_PAY_SEG  - 70599993
STGADM.CK_PER - 12815378
STGADM.CK_PREM - 3615420
STGADM.CK_REG - 11073352
STGADM.CK_SA - 7278306 
STGADM.CK_SA_REL - 7277478 
STGADM.CK_SA_SP - 6867294
STGADM.CK_SP - 3619179
STGADM.CK_SP_MTR_HIST - 7676930

And I want to insert commas into the numbers on the right. I can't do that through normal way , because the cell has both characters and numbers. How can I do this ? Or shall I use generic regex?

Was it helpful?

Solution

With values in column A , in B1 enter:

=MID(A1,1,FIND(" - ",A1)+3) & TEXT(--MID(A1,FIND(" - ",A1)+3,9999),"#,##0")

and copy down. B1 should show:

STGADM.CK_ACCT - 66,863,349

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top