How to Replace blank cell with specific value

manoj_arsul

Board Regular
Joined
Jun 27, 2018
Messages
61
I want program for below condition

1. filter to column "D" for blank .
2. Replace all blank cell in column "D" with Not OK.
3. Clear Filter .
4. filter to column "D" for Not OK.
5. filter to column "A" for Pending.
6. Replace all these pending As Pending - Not OK

Example is
Row Data
<style type="text/css"> body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Calibri"; font-size:x-small } </style>
PendingPuneIndiaOk
PendingMumbaiIndiaOk
PendingLondonEngland
PendingPuneIndia
PendingMumbaiIndiaOk
PendingMumbaiIndia
PendingLondonEngland
PendingPuneIndia
Waiting LondonEnglandOk
Waiting PuneIndiaOk
Waiting MumbaiIndia
Waiting LondonEngland
Waiting PuneIndiaOk
WorkingMumbaiIndiaOk
WorkingLondonEngland
WorkingPuneIndiaOk
WorkingMumbaiIndiaOk
ClosedLondonEngland
ClosedLondonEngland
ClosedPuneIndia
ClosedMumbaiIndia
ClosedLondonEnglandOk
ClosedPuneIndiaOk
ClosedMumbaiIndia
ClosedLondonEngland

<tbody>
[TD="bgcolor: #FFFF00"] Status* [/TD]
[TD="bgcolor: #FFFF00"] City [/TD]
[TD="bgcolor: #FFFF00"] Country [/TD]
[TD="bgcolor: #FFFF00"] Test [/TD]

</tbody>

Out Put :

<style type="text/css"> body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Calibri"; font-size:x-small } </style>
PendingPuneIndiaOk
PendingMumbaiIndiaOk
Pending - Not OKLondonEnglandNot OK
Pending - Not OKPuneIndiaNot OK
PendingMumbaiIndiaOk
Pending - Not OKMumbaiIndiaNot OK
Pending - Not OKLondonEnglandNot OK
Pending - Not OKPuneIndiaNot OK
Waiting LondonEnglandOk
Waiting PuneIndiaOk
Waiting MumbaiIndiaNot OK
Waiting LondonEnglandNot OK
Waiting PuneIndiaOk
WorkingMumbaiIndiaOk
WorkingLondonEnglandNot OK
WorkingPuneIndiaOk
WorkingMumbaiIndiaOk
ClosedLondonEnglandNot OK
ClosedLondonEnglandNot OK
ClosedPuneIndiaNot OK
ClosedMumbaiIndiaNot OK
ClosedLondonEnglandOk
ClosedPuneIndiaOk
ClosedMumbaiIndiaNot OK
ClosedLondonEnglandNot OK

<tbody>
[TD="bgcolor: #FFFF00"] Status* [/TD]
[TD="bgcolor: #FFFF00"] City [/TD]
[TD="bgcolor: #FFFF00"] Country [/TD]
[TD="bgcolor: #FFFF00"] Test [/TD]

</tbody>



 
Last edited by a moderator:

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
How about
Code:
Sub NotOk()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Offset(, 3).SpecialCells(xlBlanks).Value = "Not OK"
      .Value = Evaluate(Replace(Replace("if((@=""Pending"")*(@d=""Not OK""),""Pending-Not OK"",@)", "@d", .Offset(, 3).Address), "@", .Address))
   End With
End Sub
 
Upvote 0
How about
Code:
Sub NotOk()
   With Range("A2", Range("A" & Rows.Count).End(xlUp))
      .Offset(, 3).SpecialCells(xlBlanks).Value = "Not OK"
      .Value = Evaluate(Replace(Replace("if((@=""Pending"")*(@d=""Not OK""),""Pending-Not OK"",@)", "@d", .Offset(, 3).Address), "@", .Address))
   End With
End Sub
Thank u @Fluff
 
Last edited by a moderator:
Upvote 0
I want one more program for the below condition.(Last 5 Days Count City wise .)


1) Filter to Column "A" Status For Working .
2) Filter to Column "B" City For Pune.
3) Get Till date (Today) Count of column "A" in the cell of table ( Today 19th)
4) Filter Today()-1 & Get date Count of column "A" in the cell of table ( 18th July)
5) Filter Today()-2 & Get date Count of column "A" in the cell of table ( 17th July)
6) Filter Today()-3 & Get date Count of column "A" in the cell of table ( 16th July)
7) Filter Today()-4 & Get date Count of column "A" in the cell of table ( 15th July)

Do the Same condition with other Pending , Pending - Not OK , Waiting

Source Data: -
<style type="text/css"> body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Calibri"; font-size:x-small } </style>
Pending Pune India Ok19-Jul-18
Pending Mumbai India Ok17-Jun-18
Pending - Not OK London England Not OK16-May-18
Pending - Not OK Pune India Not OK15-Jul-18
Pending Mumbai India Ok18-Jul-18
Pending - Not OK Mumbai India Not OK19-Jul-18
Pending - Not OK London England Not OK17-Jul-18
Pending - Not OK Pune India Not OK16-Jul-18
Waiting London England Ok15-Feb-18
Waiting Pune India Ok18-Jul-18
Waiting Mumbai India Not OK19-Jul-18
Waiting London England Not OK17-Jul-18
Waiting Pune India Ok16-Jun-18
Working Mumbai India Ok5-Mar-18
Working London England Not OK18-Jul-18
Working Pune India Ok19-Jul-18
Working Pune India Ok17-Mar-18
Closed London England Not OK16-Jul-18
Closed London England Not OK15-Jul-18
Closed Pune India Not OK18-Jul-18
Closed Mumbai India Not OK19-Jul-18
Closed London England Ok17-Jul-18
Closed Pune India Ok16-Jul-18
Closed Mumbai India Not OK15-Jul-18
Closed London England Not OK18-Jul-18

<tbody>
[TD="bgcolor: #FFFF00"] Status* [/TD]
[TD="bgcolor: #FFFF00"] City [/TD]
[TD="bgcolor: #FFFF00"] Country [/TD]
[TD="bgcolor: #FFFF00"] Test [/TD]
[TD="bgcolor: #FFFF00"] Date [/TD]

</tbody>


Out Put :

<style type="text/css"> body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Calibri"; font-size:x-small } </style>
0010
0021
1021
1022
2122

<tbody>
[TD="bgcolor: #FFFF00"] Pune [/TD]
[TD="bgcolor: #DAE3F3"] Working Count [/TD]
[TD="bgcolor: #DAE3F3"] Pending Count [/TD]
[TD="bgcolor: #DAE3F3"] Pending - Not OK [/TD]
[TD="bgcolor: #DAE3F3"] Waiting Count [/TD]

[TD="bgcolor: #DAE3F3"] 15-Jul-18 [/TD]

[TD="bgcolor: #DAE3F3"] 16-Jul-18 [/TD]

[TD="bgcolor: #DAE3F3"] 17-Jul-18 [/TD]

[TD="bgcolor: #DAE3F3"] 18-Jul-18 [/TD]

[TD="bgcolor: #DAE3F3"] 19-Jul-18 [/TD]

</tbody>



 
Last edited by a moderator:
Upvote 0
As this is a completely different question, please start a new thread.
But before you do, I do not know where you are copy/pasting your posts from, but please do not do it. It normally occurs when you are pasting a table. if you follow the link in my signature you will tools to help with that.
I have had to clean a lot of them up as they are so small as to be virtually unreadable.
You can use the test board to check that things are working properly before starting a new thread
 
Last edited:
Upvote 0
ok Fluff I am going to raise new Thread for the same .

And this is not copy paste Question . Only I am going to same source data ( only for reference ).

Thank you Again !!!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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