Alternate column alert

Raph85

New Member
Joined
Dec 20, 2015
Messages
26
Hello,



I have a data, basically to count product availability per day. I want to put an alert or something like that on the first 2 column for example in column B, that if there's any of the product on any given day is less than 5 then it will list all the dates that are on low availability.

I tried to use Countif and If formula but it doesn't work as the availability column are alternate between sold column. Can anyone help me to find the best way to solve this please. Thanks


http://Excel 2016 (Windows) 32 bit
BCDEFGHIJKL
4Products1/01/20202/01/20203/01/20204/01/20205/01/2020
5SoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailable
6Batteries252530202228482464
7Pencils45545515353515473
8Books10301030103015252020
9Calculators302821812300282
10Pens5455015355050

<tbody>
</tbody>


I want it to come have the alert as per below on column B3. something like that.

http://Excel 2016 (Windows) 32 bit
BCDEFGHIJKL
3Alert!!! 02/01/2020,04/01/2020,05/01/2020
4Products1/01/20202/01/20203/01/20204/01/20205/01/2020
5SoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailable
6Batteries252530202228482464
7Pencils45545515353515473
8Books10301030103015252020
9Calculators302821812300282
10Pens5455015355050

<tbody>
</tbody>



 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
In your sample you have 5 dates across row 4. How many are there, or might there be, in your actual data?
 
Upvote 0
Hi Peter,

This will be for the whole month as it would be recorded monthly. So the date is going to be from 1 - 31.

Thanks
 
Upvote 0
You could try this user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula as shown in the screen shot below.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

Code:
Function CheckAlert(rData As Range, sHeader As String, dBelow As Double) As String
  Dim Col As Range
  Dim rws As Long
  
  sHeader = LCase(sHeader)
  rws = rData.Rows.Count - 2
  For Each Col In rData.Columns
    If LCase(Col.Cells(2).Value) = sHeader Then
      If WorksheetFunction.CountIf(Col.Offset(2).Resize(rws), "<" & dBelow) > 0 Then CheckAlert = CheckAlert & ", " & Col.Cells(1, 0).Text
    End If
  Next Col
  If Len(CheckAlert) Then CheckAlert = "Alert!!" & Mid(CheckAlert, 2)
End Function

Excel Workbook
BCDEFGHIJKLMN
3Alert!! 2/01/2020, 4/01/2020, 5/01/2020
4Products1/01/20202/01/20203/01/20204/01/20205/01/20206/01/2020
5SoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailable
6Batteries252530202228482464
7Pencils45545515353515473
8Books10301030103015252020
9Calculators302821812300282
10Pens5455015355050
Alert
 
Upvote 0
Hi Peter,

Thank you so much that's great!

just wondering would there be an option without using the VBA ?

Thanks
 
Upvote 0
Hi Peter,

Thank you so much that's great!
You're welcome.


just wondering would there be an option without using the VBA ?
If we can use a helper row? (I've used the rest of row 3)
If you don't like what is visible in C3:BL3 then you could either ..
- Format that range with white font so the dates are not visible, or
- use a different row and hide that row once your formulas have been inserted.

Formula in C3 is copied across to BL

Excel Workbook
BCDEFGHIJKLMN
3Alert!! 2/01/2020, 4/01/2020, 5/01/2020 2/01/20204/01/20205/01/2020
4Products1/01/20202/01/20203/01/20204/01/20205/01/20206/01/2020
5SoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailableSoldAvailable
6Batteries252530202228482464
7Pencils45545515353515473
8Books10301030103015252020
9Calculators302821812300282
10Pens5455015355050
Alert (2)
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,825
Members
449,096
Latest member
Erald

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