How do I replace multiple cells of text with the first Number value above them? (w/o macros)

patrickmg17

New Member
Joined
Sep 26, 2023
Messages
14
Office Version
  1. 2019
Platform
  1. Windows
Excel 2016 and I cant allow macros due to annoying business restrictions

thatthisanothersome moreagainlastly
86468465454654651651Note 165168
Note 26546+484615Note 2321316545
Note 2321651984616516516565651
Note 265165165165165165116516651
61651321651Note 1498443631816354684
161961496498466546432133Note 26546514
6194961646.52E+083131Note 2351651

I have the above cells as an example. I want to replace every instance of "Note 2" with the number value above it. So for the first column all 3 "Note 2"s should say 86468. And the ones in column 5 should be 31816. This is the most important part i need, so if you can answer that I'm happy :) but there is another part i need to figure out as well; for every instance of a row having a "Note 1" in it, i need that whole row of data deleted. Most of these rows are were the Note 2 spots pull their replacements so this part has to come after they are replaced.

I know some people have said its not possible to delete rows without macros but i figure i can accomplish the same goal by having a new sheet created and everything ported there EXCEPT the Note 1 lines that should be deleted. Essentially just making a new sheet without the stuff that will be removed
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Do a Find and Replace (Ctrl-H). Search for "Note 2" and replace with "=INDIRECT(ADDRESS(ROW()-1,COLUMN()))" (without the quotes). It will reference the cell above it. You can then copy and paste values for the whole table if you want to get rid of the equations.
 
Upvote 0
An alternative with Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,"Note 2",null,Replacer.ReplaceValue,{"that", "this", "another", "some more", "again", "lastly"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"that", "this", "another", "some more", "again", "lastly"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([another] <> "Note 1") and ([again] <> "Note 1"))
in
    #"Filtered Rows"
 
Upvote 0
Do a Find and Replace (Ctrl-H). Search for "Note 2" and replace with "=INDIRECT(ADDRESS(ROW()-1,COLUMN()))" (without the quotes). It will reference the cell above it. You can then copy and paste values for the whole table if you want to get rid of the equations.
this works well for all the Note 2 but any point for the Note 1s? I could through the lines but its still 1000s of points
 
Upvote 0
An alternative with Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Replaced Value" = Table.ReplaceValue(Source,"Note 2",null,Replacer.ReplaceValue,{"that", "this", "another", "some more", "again", "lastly"}),
    #"Filled Down" = Table.FillDown(#"Replaced Value",{"that", "this", "another", "some more", "again", "lastly"}),
    #"Filtered Rows" = Table.SelectRows(#"Filled Down", each ([another] <> "Note 1") and ([again] <> "Note 1"))
in
    #"Filtered Rows"
Sorry im new to power query, where do i go to paste this code? and this would work in 2016?
 
Upvote 0
this works well for all the Note 2 but any point for the Note 1s? I could through the lines but its still 1000s of points
For the Note 1's, I would filter by that note and then delete the lines that are showing.
 
Upvote 0
1. It will work with 2016
2.
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0
1. It will work with 2016
2.
Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
If its an Add-in anything like macros being and Add-in that needs to be enabled then i cant do it. Dumb but all that access is blocked and makes all my problems harder to solve
 
Upvote 0
You can add a column and use the equation in my Column H to detect which lines to delete. (Adjust A2:F2 to cover your whole range.) Add a filter to that column, filter by "Delete", Select the rows that have "Delete" (select the first row below your headers and then hit shift-ctrl-down), and then Delete those rows (right click, delete rows). Any rows hidden by the filter will not be deleted. This is much faster than deleting them one by one.

One downside, if you still have the equations you created with your find and replace of Note 2 and one of those ends up now being the first row below the header, the note will now mimic the header. If you copy all and paste values before doing the Note 1 filter, it will prevent this from happening. This would only break if you have information that is equation based and needs to stay that way. So, be careful, but you can get there.

temp macro work.xlsm
ABCDEFGH
1thatthisanothersome moreagainlastlysum
286468465454654651651Note 165168Delete
386468654684615651651321316545 
486468321651984616516516565651 
58646865165165165165165116516651 
661651321651Note 1498443631816354684Delete
7161961496498466546432133318166546514 
86194961646.52E+08313131816351651 
Sheet8
Cell Formulas
RangeFormula
D3,E7:E8,A3:A5D3=INDIRECT(ADDRESS(ROW()-1,COLUMN()))
H2:H8H2=IF(ISERROR(FIND("Note 1",CONCAT(A2:F2))),"","Delete")
 
Upvote 0
Power Query is not an add in for 2016 and later versions. It is located on the Data Tab and is called Get and Transform Data.

Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

- Follow this link to learn how to install Power Query in Excel 2010 / 2013.

- Follow this link for an introduction to Power Query functionality.

- Follow this link for a video which demonstrates how to use Power Query code provided.
 
Upvote 0

Forum statistics

Threads
1,223,712
Messages
6,174,031
Members
452,542
Latest member
Bricklin

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