Replace/Substitute Text with Varied Text String Lengths

jessitarexcel

Board Regular
Joined
Apr 6, 2022
Messages
60
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
  3. Web
Hello,

I have over 802 formulas that I need to update with a different suburb for each formula. This is the formula:

=IFERROR(GETPIVOTDATA("Count of Works Commenced Date",'SAG Pivot Tables - Locked'!$EV$3,"Suburb","Acacia Ridge","LGA","Brisbane City Council"),"0")

I need to replace the following value: "Suburb","Acacia Ridge" - therefore I need to update the suburb in each formula. I can do this one by one but there must be a better way. I am mucking around with Power Query and also the replace/substitute formula, however, as the suburb names vary in length, this is obviously not going to work so easily.

This is how the data is arranged:

LGA​
Suburb​
Works Commenced​
Works Completed​
BCCAcacia Ridge=IFERROR(GETPIVOTDATA("Count of Works Commenced Date",'SAG Pivot Tables - Locked'!$EV$3,"Suburb","Acacia Ridge","LGA","Brisbane City Council"),"0")
=IFERROR(GETPIVOTDATA("Count of Works Completed",'SAG Pivot Tables - Locked'!$EV$3,"Suburb","Acacia Ridge","LGA","Brisbane City Council"),"0")
LCCBerrinba=IFERROR(GETPIVOTDATA("Count of Works Commenced Date",'SAG Pivot Tables - Locked'!$EV$3,"Suburb","Berrinba","LGA","Logan City Council"),"0")
=IFERROR(GETPIVOTDATA("Count of Works Completed",'SAG Pivot Tables - Locked'!$EV$3,"Suburb","Berrinba","LGA","Logan City Council"),"0")

Firstly, may I ask, is this possible in Power Query? If not, is there an adjustment I can make to a formula to take into account the varying text string lengths? I have only been given a very short timeframe to deliver this report and it will take the whole day to type and replace each of the suburbs one by one. I am sure there must be a better way than the methods I have already tried.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
You could do the whole thing in Power Query, you wouldn't use PQ just do a final replace.

Using GetPivot you would normally structure it more like this:
(You haven't provided enough data to test it or just the correct cell references)

Book3
ABCDE
9LGA FullLGASuburbWorks CommencedWorks Completed
10Brisbane City CouncilBCCAcacia Ridge00
11Logan City CouncilLCCBerrinba00
Sheet1
Cell Formulas
RangeFormula
D10:D11D10=IFERROR(GETPIVOTDATA("Count of Works Commenced Date",'SAG Pivot Tables - Locked'!$EV$3,"Suburb",C10,"LGA",A10),"0")
E10:E11E10=IFERROR(GETPIVOTDATA("Count of Works Completed",'SAG Pivot Tables - Locked'!$EV$3,"Suburb",C10,"LGA",A10),"0")
 
Upvote 0
Solution
Oh I feel so silly. That is so simple. I was overthinking the solution. I will just rewrite the formula to refer to the table values instead of names.
 
Upvote 0
I now have it working. I just had a quotation mark around the cell reference and that is why it was not working. All good now. Thank you so much.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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