Excel Loops to find Integers in a Sequence

%3CLINGO-SUB%20id%3D%22lingo-sub-3493725%22%20slang%3D%22en-US%22%3EExcel%20Loops%20to%20find%20Integers%20in%20a%20Sequence%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3493725%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Helpful%20People%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20apply%20an%20excel%20formula%20to%20a%20string%20of%20data.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20is%20a%20screenshot%20of%20what%20I%20am%20working%20with%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20style%3D%22width%3A%20286px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F379342iA066BA5AEC3AF822%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22jwenzCHUBB_0-1654877624458.png%22%20alt%3D%22jwenzCHUBB_0-1654877624458.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20sheet%2C%20Cell%20B2%20will%20be%20automatically%20input%20as%20well%20as%20cell%20B4%20in%20the%20exact%20format%20shown%20above.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20hoping%20to%20create%20a%20formula%20that%20produces%20what%20is%20seen%20in%20cell%20B6%20as%20opposed%20to%20doing%20the%20percentage%20calculations%20and%20typing%20it%20out%20every%20time.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20loop%20through%20B4%2C%20find%20the%20different%20integers%20that%20are%20separated%20by%20the%20%24m%2F%20characters%20and%20then%20be%20able%20to%20do%20the%20simple%20division%20and%20concatenate%20the%20text%20as%20seen%20in%20B6.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnyway%20this%20is%20possible%20will%20be%20greatly%20appreciated%20and%20save%20me%20tons%20of%20time.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20so%20much!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E-JW%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3493725%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3493927%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Loops%20to%20find%20Integers%20in%20a%20Sequence%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3493927%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1376073%22%20target%3D%22_blank%22%3E%40jwenzCHUBB%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20possible.%20But%20when%20I%20see%20something%20like%20this%20I%20ask%20myself%20%22WHY%3F!%22.%20Why%20not%20split%20the%20data%20over%20three%20columns%2C%20put%20in%20some%20basic%20formulas%20and%20your%20ready%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3493949%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Loops%20to%20find%20Integers%20in%20a%20Sequence%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3493949%22%20slang%3D%22en-US%22%3EYes%2C%20very%20good%20point.%20HOWEVER%20the%20data%20is%20being%20populated%20into%20the%20cells%20via%20a%20Microsoft%20Forms%20entry%20and%20therefore%20will%20show%20up%20as%20this%20string%20in%20the%20cell%20B4.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20used%20power%20automate%20and%20it's%20being%20sent%20to%20Planner%20Tasks%20and%20if%20I%20just%20had%205%2010%2015%2C%20the%20formatting%20would%20be%20off.%3CBR%20%2F%3E%3CBR%20%2F%3EHOWEVER%20now%20that%20I'm%20typing%20this%2C%20maybe%20I%20will%20just%20input%20the%20%22%24%22%20%22m%22%20into%20the%20planner%20task%20and%20do%20what%20you're%20saying%20on%20individual%20form%20entries....%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%20for%20the%20new%20perspective%20haha.%3CBR%20%2F%3E%3CBR%20%2F%3EI'll%20work%20on%20that%20but%20if%20anyone%20does%20want%20to%20provide%20how%20to%20do%20it%2C%20that'd%20be%20a%20cool%20learning%20experience.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3494545%22%20slang%3D%22en-US%22%3ERe%3A%20Excel%20Loops%20to%20find%20Integers%20in%20a%20Sequence%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3494545%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1376073%22%20target%3D%22_blank%22%3E%40jwenzCHUBB%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20might%20work%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DLET(s%2CSEQUENCE(LEN(B4)-3)%2Cu%2CUNIQUE(FIND(%22%24%22%2CB4%2Cs))%2B1%2Cm%2CUNIQUE(FIND(%22m%22%2CB4%2Cs))%2Cd%2Cm-u%2Cp%2CMID(B4%2Cu%2Cd)%2Cper%2CTEXT(p%2FB2%2C%22(0%25)%22)%2CTEXTJOIN(%22%2F%22%2C1%2CDOLLAR(p%2C0)%26amp%3B%22m%20%22%26amp%3Bper))%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Hello Helpful People,

 

I need to apply an excel formula to a string of data. 

 

Here is a screenshot of what I am working with: 

jwenzCHUBB_0-1654877624458.png

 

In the sheet, Cell B2 will be automatically input as well as cell B4 in the exact format shown above.

 

I am hoping to create a formula that produces what is seen in cell B6 as opposed to doing the percentage calculations and typing it out every time. 

 

I need to loop through B4, find the different integers that are separated by the $m/ characters and then be able to do the simple division and concatenate the text as seen in B6.

 

Anyway this is possible will be greatly appreciated and save me tons of time.

 

Thanks so much!

 

-JW

 

 

3 Replies

@jwenzCHUBB 

It is possible. But when I see something like this I ask myself "WHY?!". Why not split the data over three columns, put in some basic formulas and your ready?

 

Yes, very good point. HOWEVER the data is being populated into the cells via a Microsoft Forms entry and therefore will show up as this string in the cell B4.

I used power automate and it's being sent to Planner Tasks and if I just had 5 10 15, the formatting would be off.

HOWEVER now that I'm typing this, maybe I will just input the "$" "m" into the planner task and do what you're saying on individual form entries....

Thanks for the new perspective haha.

I'll work on that but if anyone does want to provide how to do it, that'd be a cool learning experience.

@jwenzCHUBB 

This might work:

=LET(s,SEQUENCE(LEN(B4)-3),u,UNIQUE(FIND("$",B4,s))+1,m,UNIQUE(FIND("m",B4,s)),d,m-u,p,MID(B4,u,d),per,TEXT(p/B2,"(0%)"),TEXTJOIN("/",1,DOLLAR(p,0)&"m "&per))