Trim / Find & Add OR function somehow?

srosk

Board Regular
Joined
Sep 17, 2018
Messages
132
Hi there. I have the following code, looking for all text to the left of "Gross". Is there a way to update this to show text to the left of either "Gross" or "Net"?

Thank you

Code:
=TRIM(LEFT(A2,MIN(FIND({"GROSS"},A2&"GROSS"))-1))
 
Yes, but in situation where a number follows Net / Gross, or other words follow like "Report is Gross of fee Fund or net."
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
See if this works for you:


Book1
AB
4InputOutput
5CREDIT 129 IN NET 0.40 0.47 1.40 1.35 5.27 7.13 - 1.16CREDIT 129 IN
6CREDIT258 NL F GROSS 0.40 0.47 1.40 1.35 5.27 7.13 - 1.16CREDIT258 NL F
7Report as net of fee
8Report is Gross of fee Fund or net
9Gross fee is net of
Sheet576
Cell Formulas
RangeFormula
B5=IF(MIN(FIND({0,1,2,3,4}+{0;5},A5&1/17))>LEN(A5),"",TRIM(LEFT(A5,MIN(SEARCH(" Gross "," "&A5&" Gross "),SEARCH(" Net "," "&A5&" Net "))-1)))
 
Last edited:
Upvote 0
You're welcome, thanks for the feedback.
 
Upvote 0
You're welcome, thanks for the feedback.

Hey there. Was doing some testing - what exactly does this part of the code do?

Code:
[COLOR=#333333]IF([/COLOR][COLOR=Blue]MIN([COLOR=Red]FIND([COLOR=Green]{0,1,2,3,4}+{0;5},A5&1/17[/COLOR])[/COLOR])>LEN([COLOR=Red]A5[/COLOR]),"",[/COLOR]

It seems like the code is requiring value to the left of NET / GROSS to have a number in it. Is that what the above is doing? When I just use the following, it seems to give proper results, but wanted to confirm with you first. Thank you again for your help.

Code:
[COLOR=Blue]TRIM([COLOR=Red]LEFT([COLOR=Green]A5,MIN([COLOR=Purple]SEARCH([COLOR=Teal]" Gross "," "&A5&" Gross "[/COLOR]),SEARCH([COLOR=Teal]" Net "," "&A5&" Net "[/COLOR])[/COLOR])-1[/COLOR])[/COLOR])[/COLOR]
 
Upvote 0
The first part of my formula checks to see if there are Numbers within the Text string, if there isn't (meaning it's just a sentence), returns Blank, as per your request in Post # 7.

Without that part of the forumula, it would return Incorrect results for rows 7 & 8 for the sample in Post # 12.
 
Last edited:
Upvote 0
Oh ok, makes sense. Is it possible for the formula to search the whole line of text? Currently, it seems to be requiring a number to the left of NET/GROSS, even if there is a number to the right of NET/GROSS, if that makes sense?

CREDIT 129 IN NET 0.40 0.47 1.40 1.35 5.27 7.13 - 1.16
 
Upvote 0
My formula checks the Entire string for numbers, Not just to the left of Net/Gross.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top